{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "25225F52F805453FA8E84261042B1DD9",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "# <center> Lecture9 : Simple Normal Regression </center>  \n",
        " \n",
        "## <center> Instructor: Dr. Hu Chuan-Peng </center> "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "668D0CE355D94BD69FB40D65EE773F0E",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## Intro: 线性模型  \n",
        "\n",
        "> ⭐从lec9开始，我们将重点介绍贝叶斯模型和统计分析方法的结合  \n",
        "\n",
        "\n",
        "在lec9中，我们关注一个简单的线性模型，探究压力(stress)和自我控制(self control)之间的关系  \n",
        "\n",
        "> * 🤦‍♀️🤦‍♀️当你压力大时，或许也曾：疯狂购物、沉迷游戏；但有的时候，当你感觉到压力大时，或许也曾：卸载软件，聚精会神  \n",
        "> * 从直觉上我们能感受到似乎压力与自我控制之间存在某种联系  \n",
        "\n",
        "我们使用的数据来自Human Penguin Project (Hu et al., 2018, doi: 10.17605/OSF.IO/H52D3)，该项目使用了多种常见的心理测量量表，并在跨国人群中进行施测，其中包含了测量压力与自我控制的量表。  \n",
        "\n",
        "- 测量压力的量表共有14道题，每道题的标尺有5个水平，分值为1-5，总分的分布范围为14-70  \n",
        "\n",
        "- 测量自我控制的量表共有13道题，每道题的标尺有5个水平，分值为1-5，总分的分布范围为13-65  \n",
        "\n",
        "> * 数据来源: Hu, C.-P. et al. (2018). Raw data from the Human Penguin Project. Open Science Framework. https://doi.org/10.17605/OSF.IO/H52D3  \n",
        "> * 压力量表来源：Cohen, S., Kamarck, T. & Mermelstein, R. A global measure of perceived stress. J. Health. Soc. Behav. 24, 385–396 (1983).  \n",
        "> * 自我控制量表来源：Tangney, J. P., Baumeister, R. F. & Boone, A. L. High self-control predicts good adjustment, less pathology, better grades, and interpersonal success. J. Pers. 72, 271–324 (2004)."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "352951ACD02B4F7EAFE43B564E5203E8",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**使用线性模型表示二者关系**  \n",
        "\n",
        "* 在这个例子中，我们将每个被试的自我控制水平设为$Y$，压力水平设为$X$。在收集完n个被试的数据后，我们可以得到：  \n",
        "\n",
        "$$  \n",
        "\\left\\lbrace (Y_1,X_1), (Y_2,X_2),...,(Y_n,X_n) \\right\\rbrace  \n",
        "$$  \n",
        "\n",
        "* 我们可以使用线性模型来描述$Y$与$X$的关系，常见地，我们会将二者的关系写为：  \n",
        "\n",
        "$$  \n",
        "Y_i = \\beta_0 + \\beta_1 X_i + \\epsilon \\;\\;\\;\\;\\;\\;\\;\\;\\epsilon \\sim N(0,\\sigma^2)\\\\  \n",
        "$$  \n",
        "\n",
        "*($\\beta_0$为截距，$\\beta_1$为斜率，$\\epsilon$为残差)*  "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "752786CE980C44BFAF9A27CA429A23E4",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "# Normal linear regression  \n",
        "\n",
        "> ⭐我们也可以换一种方式来表达线性模型  \n",
        "\n",
        "*  <span style = \"color: orange;\">预测值</span> $\\mu_i$(即直线上橙色的点)可以写为：$\\mu_i = \\beta_0 + \\beta_1 X_i(1)$  \n",
        "\n",
        "* 从图上可以看到<span style = \"color: orange;\">预测值</span>和<span style = \"color: gray;\">实际值</span> (即灰色的散点)之间存在出入，实际值会在预测值附近波动  \n",
        "\n",
        "* 那么实际值可以看作服从以$\\mu_i$为均值，标准差为$\\sigma$的正态分布，即：$Y_i \\sim N(\\mu_i, \\sigma ^ 2)(2)$  \n",
        "\n",
        "![Image Name](https://cdn.kesci.com/upload/s3k1vv2eub.png?imageView2/0/w/960/h/960)  \n",
        "\n",
        "*(改编自：https: // saylordotorg.github.io/text_introductory-statistics/s14-03-modelling-linear-relationships.html)*  \n",
        "\n",
        "<br><br>  \n",
        "\n",
        "---"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "27D24CBFA5DF4DDE81403530DD197132",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**Normal data model**  \n",
        "\n",
        "将公式(1)(2)合并起来，则可以将传统的线性模型写成分布的形式：  \n",
        "  \n",
        "\n",
        "\n",
        "\n",
        "$$  \n",
        "\\begin{align*}  \n",
        "Y_i &= \\beta_0 + \\beta_1 X_i + \\epsilon \\;\\;\\;\\;\\;\\;\\;\\;\\epsilon \\sim N(0,\\sigma^2)\\\\  \n",
        "&\\Downarrow \\\\  \n",
        "Y_i | \\beta_0, \\beta_1, \\sigma &\\stackrel{ind}{\\sim} N\\left(\\mu_i, \\sigma^2\\right) \\;\\; \\text{ with } \\;\\; \\mu_i = \\beta_0 + \\beta_1X_i  .\\\\  \n",
        "\\end{align*}  \n",
        "$$  \n",
        "\n",
        "* 回归模型需满足如下假设：  \n",
        "\n",
        "    1. 独立观测假设:每个观测值$Y_i$是相互独立的，即一个观测的值不受其他观测的影响  \n",
        "\n",
        "    2. 线性关系假设: 预测值$\\mu_i$和自变量$X_i$之间可以用线性关系来描述，即：$\\mu_i = \\beta_0 + \\beta_1 X_i$  \n",
        "\n",
        "    3. 方差同质性假设： 在任意自变量的取值下，观测值$Y_i$都会以$\\mu_i$为中心，同样的标准差$\\sigma$呈正态分布变化（$\\sigma$ is consistent）  \n",
        "\n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "35D30A34BCE84BBF9368320F413DB800",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 数据  \n",
        "\n",
        "通过示例数据，大致理解压力对自我控制的影响  \n",
        "\n",
        "- 我们使用 `pandas` 的 `read_csv` 方法来读取数据 `Data_Sum_HPP_Multi_Site_Share.csv` (数据已经预先存放在和鲸平台中)。  \n",
        "- 数据包含多个变量，选择我们需要的`stress` 表示压力水平，`scontrol` 表示自我控制水平。  \n",
        "- 每一行(index)表示一个被试。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "collapsed": false,
        "id": "04B0DF8D14DF4DFF9E37C8C0BF4995CF",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "# 导入 pymc 模型包，和 arviz 等分析工具 \n",
        "import pymc as pm\n",
        "import arviz as az\n",
        "import seaborn as sns\n",
        "import scipy.stats as st\n",
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "import xarray as xr\n",
        "import pandas as pd\n",
        "\n",
        "# 忽略不必要的警告\n",
        "import warnings\n",
        "warnings.filterwarnings(\"ignore\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "collapsed": false,
        "id": "26FE34BA1FA24EDE869F4A22896F8A61",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>stress</th>\n",
              "      <th>scontrol</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>index</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>38</td>\n",
              "      <td>47</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>43</td>\n",
              "      <td>40</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>31</td>\n",
              "      <td>40</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>35</td>\n",
              "      <td>46</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>45</td>\n",
              "      <td>50</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "       stress  scontrol\n",
              "index                  \n",
              "0          38        47\n",
              "1          43        40\n",
              "2          31        40\n",
              "3          35        46\n",
              "4          45        50"
            ]
          },
          "execution_count": 2,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# 通过 pd.read_csv 加载数据 Data_Sum_HPP_Multi_Site_Share.csv\n",
        "try:\n",
        "  df_raw = pd.read_csv('/home/mw/input/bayes20238001/Data_Sum_HPP_Multi_Site_Share.csv')\n",
        "except:\n",
        "  df_raw = pd.read_csv('data/Data_Sum_HPP_Multi_Site_Share.csv')\n",
        "\n",
        "# 筛选站点为\"Tsinghua\"的数据\n",
        "df = df_raw[df_raw[\"Site\"] == \"Tsinghua\"]\n",
        "\n",
        "# 选择需要的两列\n",
        "df = df[[\"stress\",\"scontrol\"]]\n",
        "\n",
        "#设置索引\n",
        "df[\"index\"] = range(len(df))\n",
        "df = df.set_index(\"index\")\n",
        "\n",
        "# 显示部分数据\n",
        "df.head()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2E3EB2B5CE134B789F1AD62BE884849C",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "进一步可视化数据情况  \n",
        "* 我们使用 `seaborn` 的 `regplot` 方法来绘制回归图  \n",
        "* 其中横轴为压力分数 `x=\"stress\"`，纵轴为自我控制分数 `y=\"scontrol\"`。  \n",
        "* 需要注意的是，`regplot` 方法会同时绘制**数据的散点图**以及**y关于x的回归线条**。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "collapsed": false,
        "id": "BD2250A42D9D448D8414E639ABAC80CA",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/BD2250A42D9D448D8414E639ABAC80CA/s3qz6o9ghv.png\">"
            ],
            "text/plain": [
              "<Figure size 640x480 with 1 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "# 使用 `regplot`方法可视化数据。data表示传入的数据，x为自变量，y为因变量。\n",
        "sns.regplot(x=\"stress\", y=\"scontrol\", data=df)\n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "91D9CFB92EAE46C4BE8FF72D2F92181D",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 定义先验  \n",
        "\n",
        "从数据中可知，我们主要关注两个数据变量：自我控制水平$Y$，压力水平$X$  \n",
        "\n",
        "$$  \n",
        "Y_i | \\beta_0, \\beta_1, \\sigma \\stackrel{ind}{\\sim} N\\left(\\mu_i, \\sigma^2\\right) \\;\\; \\text{ with } \\;\\; \\mu_i = \\beta_0 + \\beta_1X_i  \n",
        "$$  \n",
        "\n",
        "而根据之前的模型公式(数据模型)可发现，存在三个未知的参数$\\beta_0，\\beta_1，\\sigma$  \n",
        "\n",
        "* 在贝叶斯模型的框架下，我们需要为未知的参数指定先验：  \n",
        " \n",
        "$$  \n",
        "Y_i \\sim N\\left(\\mu_i, \\sigma^2\\right) \\;\\; \\text{ with } \\;\\; \\mu_i = \\beta_0 + \\beta_1X_i  .\\\\  \n",
        "$$  \n",
        "\n",
        "$$  \n",
        "\\beta_0    \\sim N\\left(m_0, s_0^2 \\right)  \\\\  \n",
        "\\beta_1   \\sim N\\left(m_1, s_1^2 \\right) \\\\  \n",
        "\\sigma \\sim \\text{Exp}(l)  \n",
        "$$  \n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0B126A6D5BAA47FBA8CFC231D121DE4E",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "> * 参数的前提假设(assumptions):  \n",
        ">    * $\\beta_0，\\beta_1，\\sigma$ 之间相互独立  \n",
        "> * 此外，规定 $\\sigma$ 服从指数分布，以限定其值恒为正数  \n",
        "> * 其中，$m_0，s_0，m_1，s_1$为超参数  \n",
        ">    * 我们需要根据我们对$\\beta_0$和$\\beta_1$的先验理解来选择超参数的范围  \n",
        ">    * 比如，$\\beta_1$反映了压力分数每增加1分，自我控制分数上升的值；$\\beta_0$反映了压力分数为0时，自我控制分数的值  \n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "F02F13E0923E47D59221A79725DF27DC",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**指定超参数**  \n",
        "\n",
        "$$  \n",
        "\\begin{equation}  \n",
        "\\begin{array}{lcrl}  \n",
        "\\text{data:} & \\hspace{.05in} &   Y_i | \\beta_0, \\beta_1, \\sigma & \\stackrel{ind}{\\sim} N\\left(\\mu_i, \\sigma^2\\right) \\;\\; \\text{ with } \\;\\; \\mu_i = \\beta_0 + \\beta_1X_i \\\\  \n",
        "\n",
        "\\text{priors:} & & \\beta_{0}  & \\sim N\\left(70, 4^2 \\right)  \\\\  \n",
        "                    & & \\beta_1  & \\sim N\\left(0, 0.8^2 \\right) \\\\  \n",
        "                    & & \\sigma   & \\sim \\text{Exp}(0.6)  .\\\\  \n",
        "\\end{array}  \n",
        "\\end{equation}  \n",
        "$$  \n",
        "\n",
        "这里，我们根据生活经验或直觉对超参数进行了定义：  \n",
        "- 我们假设 $\\beta_1$ 服从正态分布，其均值为0，标准差为0.8。 代表了：  \n",
        "\n",
        "  * (斜率)将其均值指定为0，表明我们并未指定压力对自我控制的影响方向，压力既可能促进也可能抑制自我控制。  \n",
        "\n",
        "    * 这个影响的量是变化的，范围大概在0 ± 0.8  \n",
        "\n",
        "* 其次，我们假设 $\\beta_0$ 服从正态分布，其均值为70，标准差为4。 代表了：  \n",
        "\n",
        "  * （截距）当压力水平为0时，自我控制水平大概为70；    \n",
        "\n",
        "  * 然而，这个值是变化的，$\\beta_0$ 大概范围为 70 ± 4。  \n",
        "   \n",
        "* 最后，我们假设 $\\sigma$ 服从指数分布，其参数为0.6。 从下图可见，其范围在0到6。  \n",
        "\n",
        "  * 它代表了预测值在$\\mu_i$附近波动的范围  \n",
        "\n",
        "\n",
        "* 可视化指定超参下的先验：  \n",
        "\n",
        "\n",
        "![Image Name](https://cdn.kesci.com/upload/s3pbojw6fn.png?imageView2/0/w/960/h/960)  \n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "EE6E6D17329A41398B918910A8A83CA9",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 先验预测检验(prior predictive check)  \n",
        "\n",
        "🤔有些同学可能认为这个先验的定义过于随意，甚至有些不靠谱。 那我们是否可以检验先验的合理性，以及适当的调整这个先验呐？  \n",
        "\n",
        "**我们通过代码来说明，如何进行先验预测检验**  \n",
        "\n",
        "首先根据公式，先验模型为：  \n",
        "\n",
        "$$  \n",
        "\\begin{align*}  \n",
        "\\text{priors:} & & \\beta_{0}  & \\sim N\\left(70, 4^2 \\right)  \\\\  \n",
        "                    & & \\beta_1  & \\sim N\\left(0, 0.8^2 \\right) \\\\  \n",
        "                    & & \\sigma   & \\sim \\text{Exp}(0.6)  .\\\\  \n",
        "\\end{align*}  \n",
        "$$"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "C2A5738FAD514E1691F15A032D6AE83C",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**先验预测检验的大致思路**  \n",
        "\n",
        "1. 在先验中随机抽取200组$\\beta_0, \\beta_1$值  \n",
        "\n",
        "2. 生成假数据自变量X  \n",
        "\n",
        "3. 生成200条 $\\beta_0 + \\beta_1 X$, 观察其中的预测值是否处在合理的范围内  \n",
        "\n",
        "> 我们一步一步来看"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "E539862B13B64A2BB07559076E9D7CE5",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "1. 在先验中随机抽取200组$\\beta_0, \\beta_1$值  "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "collapsed": false,
        "id": "9265E74E026C4FDDA0D2334D7AC2C4C8",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>beta0</th>\n",
              "      <th>beta1</th>\n",
              "      <th>sigma</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>72.075109</td>\n",
              "      <td>-0.910879</td>\n",
              "      <td>2.284709</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>68.728191</td>\n",
              "      <td>-0.803882</td>\n",
              "      <td>0.385791</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>73.663583</td>\n",
              "      <td>-0.951329</td>\n",
              "      <td>2.781754</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>73.150642</td>\n",
              "      <td>0.318252</td>\n",
              "      <td>2.587576</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>68.638993</td>\n",
              "      <td>-1.449139</td>\n",
              "      <td>2.132834</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>195</th>\n",
              "      <td>64.747908</td>\n",
              "      <td>0.110601</td>\n",
              "      <td>3.944814</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>196</th>\n",
              "      <td>69.821940</td>\n",
              "      <td>0.794712</td>\n",
              "      <td>5.615775</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>197</th>\n",
              "      <td>70.779998</td>\n",
              "      <td>1.594084</td>\n",
              "      <td>2.279739</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>198</th>\n",
              "      <td>71.729835</td>\n",
              "      <td>-1.099491</td>\n",
              "      <td>0.073780</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>199</th>\n",
              "      <td>71.902415</td>\n",
              "      <td>-0.635247</td>\n",
              "      <td>2.550560</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>200 rows × 3 columns</p>\n",
              "</div>"
            ],
            "text/plain": [
              "         beta0     beta1     sigma\n",
              "0    72.075109 -0.910879  2.284709\n",
              "1    68.728191 -0.803882  0.385791\n",
              "2    73.663583 -0.951329  2.781754\n",
              "3    73.150642  0.318252  2.587576\n",
              "4    68.638993 -1.449139  2.132834\n",
              "..         ...       ...       ...\n",
              "195  64.747908  0.110601  3.944814\n",
              "196  69.821940  0.794712  5.615775\n",
              "197  70.779998  1.594084  2.279739\n",
              "198  71.729835 -1.099491  0.073780\n",
              "199  71.902415 -0.635247  2.550560\n",
              "\n",
              "[200 rows x 3 columns]"
            ]
          },
          "execution_count": 4,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# 设置随机种子确保结果可以重复\n",
        "np.random.seed(84735)\n",
        "\n",
        "# 根据设定的先验分布，在其中各抽取200个beta_0,200个beta_1, 200个sigma\n",
        "beta0_200 = np.random.normal(loc = 70, scale =4 , size = 200)\n",
        "beta1_200 = np.random.normal(loc = 0, scale =0.8 , size = 200)\n",
        "sigma_200 = np.random.exponential(scale=1/0.6, size=200)\n",
        "\n",
        "#将结果存在一个数据框内\n",
        "prior_pred_sample = pd.DataFrame({\"beta0\":beta0_200,\n",
        "                                  \"beta1\":beta1_200,\n",
        "                                  \"sigma\":sigma_200})\n",
        "#查看抽样结果                                \n",
        "prior_pred_sample"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "90AAF23896904CD7BC8E3B73E365697D",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "2. 生成假数据自变量X  \n",
        "   \n",
        "- 这里我们根据现实情况来定义X的取值范围  \n",
        "\n",
        "    - 根据量表的结构，压力分数的范围为14-70  \n",
        "\n",
        "- 我们使用 `np.arange`设置压力分数  \n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "collapsed": false,
        "id": "BF8DF91DC4974D079035FB1BB8E5E3EF",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,\n",
              "       31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,\n",
              "       48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,\n",
              "       65, 66, 67, 68, 69, 70])"
            ]
          },
          "execution_count": 5,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# 通过np.arange设置压力分数，从 14,15...70。\n",
        "x_sim = np.arange(start=14,stop=71,step=1)\n",
        "\n",
        "x_sim"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0D8381E422A0458A89E563B62A8310C8",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "3. 根据公式 $\\mu = \\beta_0 + \\beta_1 X$ 生成200条回归线, 观察其中的$\\mu$是否处在合理的范围内  \n",
        "\n",
        "- 我们有200次采样，每次采样都有三个参数 beta_0, beta_1, sigma。  \n",
        "\n",
        "- 结合每次采样的结果，和自变量X，我们可以生成一条直线  \n",
        "\n",
        "- 重复这个过程200次，我们就能生成200条直线  \n",
        "\n",
        "> **我们通过代码来理解一次采样的过程**  \n",
        "\n",
        "\n",
        "![Image Name](https://cdn.kesci.com/upload/s3pfncehtc.png?imageView2/0/w/960/h/960)  \n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "BF6684236E574893873F783C3324221B",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "🎯练习：  \n",
        "\n",
        "根据获取的第一条MCMC链的第一组采样参数，结合自变量X的范围，预测 $\\mu$ 的值。  \n",
        "\n",
        "1. 根据回归公式 $\\mu = \\beta_0 + \\beta_1 X$ 预测$\\mu$ 的值。  \n",
        "2. 绘制回归线条。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "collapsed": false,
        "id": "1B55C0B724684FEDB85D77DC0C567945",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "获取的第一组采样参数值，beta_0:72.08, beta_1:-0.91\n"
          ]
        }
      ],
      "source": [
        "# 获取第一组采样参数\n",
        "beta_0 = prior_pred_sample[\"beta0\"][0]\n",
        "beta_1 = prior_pred_sample[\"beta1\"][0]\n",
        "\n",
        "print(f\"获取的第一组采样参数值，beta_0:{beta_0:.2f}, beta_1:{beta_1:.2f}\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "collapsed": false,
        "id": "7819506BC4604E4D976B61F5CB8182F5",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "#===========================\n",
        "#     根据回归公式 $\\mu = \\beta_0 + \\beta_1 X$ 预测$\\mu$ 的值。\n",
        "#     已知：X （x_sim） 的范围为14-71\n",
        "#===========================\n",
        "x_sim = np.arange(start=14,stop=71,step=1)\n",
        "mu = ...\n",
        "print(\"预测值\",mu)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "id": "451692C69C75440495912A0DE0E85788",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "#===========================\n",
        "#     绘制回归线，请设置x轴和y轴的变量\n",
        "#===========================\n",
        "x_axis = ...\n",
        "y_axis = ...\n",
        "plt.plot(x_axis,y_axis)\n",
        "plt.xlabel(\"Stress\")\n",
        "plt.ylabel(\"Self Control\")\n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "F4980095AB7B44E5996C624B8337E7C9",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "> 重复上述结果200遍，我们就能得到200次先验预测回归线了  \n",
        "\n",
        "**可视化先验预测结果**  \n",
        "\n",
        "- 每一条线代表一次抽样生成的预测，因此我们绘制了200条线。  \n",
        "\n",
        "- 我们可以观测到自我控制水平(纵坐标)的范围随着压力(横坐标)的变化。  \n",
        "\n",
        "- 自我控制水平的范围大概为(-50~200)  \n",
        "\n",
        "> * 因为我们提供了一个**弱信息**的先验，所以自我控制水平出现了负数和过高的值。  \n",
        "> * 但当我们提供数据时，这个范围会更接近真实，因此我们不必过于担心自我控制分数真的为负数😜。  \n",
        "> * 相反，如果我们设置一个强信息先验，那么先验预测的结果可能更符合现实，但当数据加入模型时，模型可能并不能反映真实的数据。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "collapsed": false,
        "id": "486A1693589D417A8835A2E048008F61",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "# 通过np.arange设置压力分数，从 14,15...70。\n",
        "x_sim = np.arange(start=14,stop=71,step=1)\n",
        "\n",
        "# 设置一个空列表，用来储存每一个的预测结果\n",
        "mu_outcome = []\n",
        "\n",
        "#重复单次先验预测200次\n",
        "for i in range(len(prior_pred_sample)):\n",
        "    mu = prior_pred_sample[\"beta0\"][i] + prior_pred_sample[\"beta1\"][i]*x_sim\n",
        "    mu_outcome.append(mu)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "id": "8DAF098C782D4D5E9FB3683458B0986D",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/8DAF098C782D4D5E9FB3683458B0986D/s3qz7jpdq6.png\">"
            ],
            "text/plain": [
              "<Figure size 640x480 with 1 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "# 画出每一次的先验预测结果\n",
        "for i in range(len(mu_outcome)):\n",
        "    plt.plot(x_sim, mu_outcome[i])\n",
        "\n",
        "plt.title(\"prior predictive check\")\n",
        "plt.xlabel(\"Stress\")\n",
        "plt.ylabel(\"Self Control\")\n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "66DDFD2E18A149AEA0B1152D061AA58A",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 我们的先验设置的合理吗？  \n",
        "\n",
        "回过来看看我们的问题现状  \n",
        "- $X$: 主观压力，量表共有14道题，每道题的标尺有5个水平，分值为1 - 5，总分的分布范围为14-70  \n",
        "\n",
        "- $Y$: 自我控制，量表共有13道题，每道题的标尺有5个水平，分值为1 - 5，总分的分布范围为13-65  \n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3DC422F5C2BB4C339C66F13A1FBB00F0",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 后验分布  \n",
        "\n",
        "### 模型定义  \n",
        "\n",
        "现在，我们可以结合数据与先验，为参数$(\\beta_0, \\beta_1, \\sigma)$生成后验模型  \n",
        "\n",
        "* 在lec7中我们已经知道，当后验分布过于复杂时，可以使用MCMC来近似后验分布  \n",
        "\n",
        "    * 我们使用pymc来完成采样过程  \n",
        "\n",
        "\n",
        "在这之前，我们回顾之前对先验与似然的定义：  \n",
        "\n",
        "* > $Y_i {\\sim} N\\left(\\mu_i, \\sigma^2\\right)$  \n",
        "\n",
        "* > $\\beta_{0}   \\sim N\\left(70, 4^2 \\right)$  \n",
        "\n",
        "* > $\\beta_1   \\sim N\\left(0, 0.8^2 \\right)$  \n",
        "\n",
        "* > $\\mu_i = \\beta_0 + \\beta_1X_i$  \n",
        "\n",
        "* > $\\sigma   \\sim \\text{Exp}(0.6)$  \n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "collapsed": false,
        "id": "04277A89B81D4D37ADF217D0DE2EAF26",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "with pm.Model() as linear_model:\n",
        "\n",
        "    beta_0 = pm.Normal(\"beta_0\", mu=70, sigma=4)          #定义beta_0          \n",
        "    beta_1 = pm.Normal(\"beta_1\", mu=0, sigma=0.8)         #定义beta_1\n",
        "    sigma = pm.Exponential(\"sigma\", 0.6)                  #定义sigma\n",
        "\n",
        "    x = pm.MutableData(\"x\",df.stress)                     #x是自变量压力水平\n",
        "\n",
        "    mu = beta_0 + beta_1 * x                              #定义mu，讲自变量与先验结合\n",
        "\n",
        "    likelihood = pm.Normal(\"y_est\", mu=mu, sigma=sigma, observed=df.scontrol)   #定义似然：预测值y符合N(mu, sigma)分布\n",
        "                                                                                #通过 observed 传入实际数据y 自我控制水平"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "828BEC6E72F44D26AF9A44542294C578",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 后验模拟  \n",
        "\n",
        "1. 接下来我们使用`pm.sample()`进行mcmc采样  \n",
        "\n",
        "* 我们指定了4条马尔科夫链，保留的采样数为5000，对于每一个参数，在每条链上都有5000个采样结果  \n",
        "\n",
        "    * $\\left\\lbrace \\beta_0^{(1)}, \\beta_0^{(2)}, \\ldots, \\beta_0^{(5000)} \\right\\rbrace$  \n",
        "\n",
        "    * $\\left\\lbrace \\beta_1^{(1)}, \\beta_1^{(2)}, \\ldots, \\beta_1^{(5000)} \\right\\rbrace$  \n",
        "    \n",
        "    * $\\left\\lbrace \\sigma_1^{(1)}, \\sigma_1^{(2)}, \\ldots, \\sigma_1^{(5000)} \\right\\rbrace$  \n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "collapsed": false,
        "id": "0485F608B36E45AFBC364E05318E841E",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Auto-assigning NUTS sampler...\n",
            "Initializing NUTS using jitter+adapt_diag...\n",
            "Multiprocess sampling (4 chains in 4 jobs)\n",
            "NUTS: [beta_0, beta_1, sigma]\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "\n",
              "<style>\n",
              "    /* Turns off some styling */\n",
              "    progress {\n",
              "        /* gets rid of default border in Firefox and Opera. */\n",
              "        border: none;\n",
              "        /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
              "        background-size: auto;\n",
              "    }\n",
              "    progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
              "        background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
              "    }\n",
              "    .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
              "        background: #F44336;\n",
              "    }\n",
              "</style>\n"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Sampling 4 chains for 1_000 tune and 5_000 draw iterations (4_000 + 20_000 draws total) took 20 seconds.\n"
          ]
        }
      ],
      "source": [
        "#===========================\n",
        "#     注意！！！以下代码可能需要运行1-2分钟左右\n",
        "#===========================\n",
        "with linear_model:\n",
        "    trace = pm.sample(draws=5000,                   # 使用mcmc方法进行采样，draws为采样次数\n",
        "                      tune=1000,                    # tune为调整采样策略的次数，可以决定这些结果是否要被保留\n",
        "                      chains=4,                     # 链数\n",
        "                      discard_tuned_samples=True,  # tune的结果将在采样结束后被丢弃\n",
        "                      random_seed=84735)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5A1DDE0C4854466F952AC2690ED64805",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "2. 在采样结束之后，我们得到采样样本 trace  \n",
        "\n",
        "- 后验样本储存在`trace.posterior`中，它的数据类型为 xarray。  \n",
        "\n",
        "  - 包括了两个维度(索引)，第一个维度为链chain，第二个维度为采样draw  \n",
        "  \n",
        "  - 包含了3个变量，即3个参数beta_0, beta_1, sigma  \n",
        "\n",
        "\t- 我们可以使用 `trace.posterior['beta_0']`提取后验中的$\\beta_0$参数  \n",
        "\n",
        "\t- 我们可以使用 `trace.posterior['beta_0'][0, 10]`提取$\\beta_0$第一条链中第10个采样值"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "metadata": {
        "collapsed": false,
        "id": "4FDD9D06D8C0418D9EA7FFCB6CB9704C",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\n",
              "            <div>\n",
              "              <div class='xr-header'>\n",
              "                <div class=\"xr-obj-type\">arviz.InferenceData</div>\n",
              "              </div>\n",
              "              <ul class=\"xr-sections group-sections\">\n",
              "              \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_posteriore77e0b03-9189-47bd-8fe0-15a14afde01f\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_posteriore77e0b03-9189-47bd-8fe0-15a14afde01f\" class = \"xr-section-summary\">posterior</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:  (chain: 4, draw: 5000)\n",
              "Coordinates:\n",
              "  * chain    (chain) int64 0 1 2 3\n",
              "  * draw     (draw) int64 0 1 2 3 4 5 6 7 ... 4993 4994 4995 4996 4997 4998 4999\n",
              "Data variables:\n",
              "    beta_0   (chain, draw) float64 58.87 58.57 57.45 58.36 ... 64.75 63.68 61.97\n",
              "    beta_1   (chain, draw) float64 -0.4782 -0.4796 -0.4733 ... -0.606 -0.5615\n",
              "    sigma    (chain, draw) float64 5.695 5.506 5.278 5.206 ... 5.174 5.181 5.28\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:48:34.424207\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0\n",
              "    sampling_time:              19.658550024032593\n",
              "    tuning_steps:               1000</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-58d52b3f-6347-422f-befa-a060fef78caa' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-58d52b3f-6347-422f-befa-a060fef78caa' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>chain</span>: 4</li><li><span class='xr-has-index'>draw</span>: 5000</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-3b6a4783-7fc6-49f2-b198-4ccf36c6ab06' class='xr-section-summary-in' type='checkbox'  checked><label for='section-3b6a4783-7fc6-49f2-b198-4ccf36c6ab06' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>chain</span></div><div class='xr-var-dims'>(chain)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-ba918738-4f41-4c60-8463-0f01f6421c41' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ba918738-4f41-4c60-8463-0f01f6421c41' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6b39b806-ed53-4f05-998c-0165e4a4c97b' class='xr-var-data-in' type='checkbox'><label for='data-6b39b806-ed53-4f05-998c-0165e4a4c97b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>draw</span></div><div class='xr-var-dims'>(draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 ... 4996 4997 4998 4999</div><input id='attrs-6c057e79-ead0-4346-825a-d7a6dd6d32c9' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6c057e79-ead0-4346-825a-d7a6dd6d32c9' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-db0160dd-c040-4f95-ab40-8fb265d3683a' class='xr-var-data-in' type='checkbox'><label for='data-db0160dd-c040-4f95-ab40-8fb265d3683a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([   0,    1,    2, ..., 4997, 4998, 4999])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-e03e2483-c771-4de3-a960-118a4528ce86' class='xr-section-summary-in' type='checkbox'  checked><label for='section-e03e2483-c771-4de3-a960-118a4528ce86' class='xr-section-summary' >Data variables: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>beta_0</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>58.87 58.57 57.45 ... 63.68 61.97</div><input id='attrs-c2425966-bb42-4125-b8bb-ffee7e9d6842' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c2425966-bb42-4125-b8bb-ffee7e9d6842' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f3efa9f8-1b28-4fd7-ad7a-1aa70487ef32' class='xr-var-data-in' type='checkbox'><label for='data-f3efa9f8-1b28-4fd7-ad7a-1aa70487ef32' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[58.86695078, 58.57345176, 57.44999204, ..., 56.87899891,\n",
              "        55.18460974, 56.52524464],\n",
              "       [60.33121294, 60.48527833, 60.17064049, ..., 60.95351092,\n",
              "        59.88658912, 59.21138754],\n",
              "       [62.85570065, 58.3407012 , 58.76709596, ..., 58.91063931,\n",
              "        59.11366693, 56.22569953],\n",
              "       [60.60435197, 60.45496042, 59.04095076, ..., 64.74854344,\n",
              "        63.67703222, 61.97186055]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>beta_1</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-0.4782 -0.4796 ... -0.606 -0.5615</div><input id='attrs-e674dcf6-b185-4a85-86e7-7e53e1c1866b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e674dcf6-b185-4a85-86e7-7e53e1c1866b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-27773a82-34b3-41de-8c6b-e08c9be69309' class='xr-var-data-in' type='checkbox'><label for='data-27773a82-34b3-41de-8c6b-e08c9be69309' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-0.47815269, -0.47960299, -0.47329089, ..., -0.42593683,\n",
              "        -0.39486588, -0.42089611],\n",
              "       [-0.51268782, -0.50433481, -0.49923909, ..., -0.52666009,\n",
              "        -0.51493146, -0.50053525],\n",
              "       [-0.58902235, -0.48703451, -0.47460662, ..., -0.4849174 ,\n",
              "        -0.48953898, -0.42489017],\n",
              "       [-0.53537063, -0.52778124, -0.49040009, ..., -0.637929  ,\n",
              "        -0.60601105, -0.56154305]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>sigma</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.695 5.506 5.278 ... 5.181 5.28</div><input id='attrs-d4f79f0e-70bc-4d46-9b68-fd54e5d7f8cf' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d4f79f0e-70bc-4d46-9b68-fd54e5d7f8cf' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-35e8b538-5e37-400f-ab3d-778550b8ea4c' class='xr-var-data-in' type='checkbox'><label for='data-35e8b538-5e37-400f-ab3d-778550b8ea4c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[5.69492348, 5.50571801, 5.27834405, ..., 5.1234742 , 5.36884129,\n",
              "        5.37981517],\n",
              "       [5.36547203, 5.35886386, 5.5625251 , ..., 5.33677941, 5.49468206,\n",
              "        5.44005124],\n",
              "       [6.22619008, 5.13127956, 5.06342675, ..., 5.21723714, 5.2071525 ,\n",
              "        5.07363044],\n",
              "       [5.21726127, 5.76379417, 5.13829373, ..., 5.17424356, 5.181334  ,\n",
              "        5.27979956]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c2776945-35a7-43f3-b6fd-6706ecd13a46' class='xr-section-summary-in' type='checkbox'  checked><label for='section-c2776945-35a7-43f3-b6fd-6706ecd13a46' class='xr-section-summary' >Attributes: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:48:34.424207</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd><dt><span>sampling_time :</span></dt><dd>19.658550024032593</dd><dt><span>tuning_steps :</span></dt><dd>1000</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_sample_stats5ebfd989-d862-4125-a270-95cd2a36f0ad\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_sample_stats5ebfd989-d862-4125-a270-95cd2a36f0ad\" class = \"xr-section-summary\">sample_stats</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:                (chain: 4, draw: 5000)\n",
              "Coordinates:\n",
              "  * chain                  (chain) int64 0 1 2 3\n",
              "  * draw                   (draw) int64 0 1 2 3 4 5 ... 4995 4996 4997 4998 4999\n",
              "Data variables: (12/17)\n",
              "    perf_counter_start     (chain, draw) float64 6.111e+05 ... 6.111e+05\n",
              "    smallest_eigval        (chain, draw) float64 nan nan nan nan ... nan nan nan\n",
              "    max_energy_error       (chain, draw) float64 0.4421 -0.06822 ... -0.02704\n",
              "    process_time_diff      (chain, draw) float64 0.004055 0.002102 ... 0.002762\n",
              "    step_size_bar          (chain, draw) float64 0.2141 0.2141 ... 0.1929 0.1929\n",
              "    energy_error           (chain, draw) float64 0.06449 -0.04859 ... -0.02542\n",
              "    ...                     ...\n",
              "    acceptance_rate        (chain, draw) float64 0.8256 0.9937 ... 0.9964 0.9973\n",
              "    tree_depth             (chain, draw) int64 5 4 4 2 1 4 5 3 ... 4 4 3 5 4 3 4\n",
              "    largest_eigval         (chain, draw) float64 nan nan nan nan ... nan nan nan\n",
              "    n_steps                (chain, draw) float64 31.0 15.0 11.0 ... 7.0 15.0\n",
              "    lp                     (chain, draw) float64 -552.2 -551.7 ... -554.0 -552.3\n",
              "    diverging              (chain, draw) bool False False False ... False False\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:48:34.476368\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0\n",
              "    sampling_time:              19.658550024032593\n",
              "    tuning_steps:               1000</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-0709a3c6-db24-4793-8b5f-ad45e40ec4c7' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-0709a3c6-db24-4793-8b5f-ad45e40ec4c7' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>chain</span>: 4</li><li><span class='xr-has-index'>draw</span>: 5000</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-1122cee2-02b5-4648-826a-89e1dbc07f91' class='xr-section-summary-in' type='checkbox'  checked><label for='section-1122cee2-02b5-4648-826a-89e1dbc07f91' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>chain</span></div><div class='xr-var-dims'>(chain)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-3283d728-643b-4f5a-991e-e6a45439bd46' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3283d728-643b-4f5a-991e-e6a45439bd46' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ff0e5c97-2f3f-4bbf-8894-b8d7d65a3831' class='xr-var-data-in' type='checkbox'><label for='data-ff0e5c97-2f3f-4bbf-8894-b8d7d65a3831' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>draw</span></div><div class='xr-var-dims'>(draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 ... 4996 4997 4998 4999</div><input id='attrs-793cdda9-574e-4aa2-b77e-aa7a2673ec91' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-793cdda9-574e-4aa2-b77e-aa7a2673ec91' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2935038e-9274-4ffd-b292-81fb10eaa05d' class='xr-var-data-in' type='checkbox'><label for='data-2935038e-9274-4ffd-b292-81fb10eaa05d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([   0,    1,    2, ..., 4997, 4998, 4999])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-a7cf97d1-3417-4e40-88a0-606f89a5ba2a' class='xr-section-summary-in' type='checkbox'  ><label for='section-a7cf97d1-3417-4e40-88a0-606f89a5ba2a' class='xr-section-summary' >Data variables: <span>(17)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>perf_counter_start</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>6.111e+05 6.111e+05 ... 6.111e+05</div><input id='attrs-3e89da7f-9f55-4db1-9271-7653d6b11866' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3e89da7f-9f55-4db1-9271-7653d6b11866' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9010c173-367d-4843-8689-6d9e8f51d080' class='xr-var-data-in' type='checkbox'><label for='data-9010c173-367d-4843-8689-6d9e8f51d080' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[611086.40402631, 611086.40827664, 611086.41054607, ...,\n",
              "        611101.28393716, 611101.28821506, 611101.29049867],\n",
              "       [611085.94239744, 611085.94473085, 611085.94557199, ...,\n",
              "        611101.96581446, 611101.96632694, 611101.96860092],\n",
              "       [611086.37831622, 611086.37989589, 611086.3822482 , ...,\n",
              "        611101.07584482, 611101.07814133, 611101.07943409],\n",
              "       [611086.35247979, 611086.35486087, 611086.35720723, ...,\n",
              "        611100.92371047, 611100.92605879, 611100.92766347]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>smallest_eigval</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>nan nan nan nan ... nan nan nan nan</div><input id='attrs-d1fac363-4973-4274-8b18-72dd74f54fa1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d1fac363-4973-4274-8b18-72dd74f54fa1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6e14c85e-be43-4ab8-9c63-39c9e7203e58' class='xr-var-data-in' type='checkbox'><label for='data-6e14c85e-be43-4ab8-9c63-39c9e7203e58' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[nan, nan, nan, ..., nan, nan, nan],\n",
              "       [nan, nan, nan, ..., nan, nan, nan],\n",
              "       [nan, nan, nan, ..., nan, nan, nan],\n",
              "       [nan, nan, nan, ..., nan, nan, nan]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>max_energy_error</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.4421 -0.06822 ... -0.02704</div><input id='attrs-30a5a12a-7800-481a-a82d-7122a84bdd86' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-30a5a12a-7800-481a-a82d-7122a84bdd86' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9576f8a8-38b3-4c84-8bd7-513fbfb963c6' class='xr-var-data-in' type='checkbox'><label for='data-9576f8a8-38b3-4c84-8bd7-513fbfb963c6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[ 0.44207851, -0.0682207 ,  1.36760879, ...,  0.4273466 ,\n",
              "         1.49304288,  0.04470926],\n",
              "       [-0.50962167,  1.08574964, -1.12791373, ...,  4.25740033,\n",
              "        -0.16886245,  0.33920468],\n",
              "       [ 0.08787635,  0.53682546, -0.66486973, ..., -0.10903126,\n",
              "         0.24502403,  0.14894427],\n",
              "       [ 0.71626288, -0.18166289, -0.04554903, ..., -0.26388567,\n",
              "        -0.17619507, -0.02703934]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>process_time_diff</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.004055 0.002102 ... 0.002762</div><input id='attrs-ec8a2ffe-0fcb-4060-94c6-5a1d2504a72f' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ec8a2ffe-0fcb-4060-94c6-5a1d2504a72f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-813ec89a-48e9-4b6b-b865-851ca623281b' class='xr-var-data-in' type='checkbox'><label for='data-813ec89a-48e9-4b6b-b865-851ca623281b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[0.00405451, 0.00210151, 0.00165   , ..., 0.00409466, 0.00210375,\n",
              "        0.00161468],\n",
              "       [0.00214134, 0.00067534, 0.00185394, ..., 0.00034199, 0.00209556,\n",
              "        0.0020736 ],\n",
              "       [0.00139208, 0.00216728, 0.0006693 , ..., 0.00210353, 0.00111737,\n",
              "        0.00215322],\n",
              "       [0.0021807 , 0.00213587, 0.00213784, ..., 0.00212048, 0.0014025 ,\n",
              "        0.00276151]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>step_size_bar</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.2141 0.2141 ... 0.1929 0.1929</div><input id='attrs-9f390c6c-a573-494f-b3a9-3743262f1ded' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-9f390c6c-a573-494f-b3a9-3743262f1ded' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-137bd9ec-6493-4d23-bd8f-4085ccd6449e' class='xr-var-data-in' type='checkbox'><label for='data-137bd9ec-6493-4d23-bd8f-4085ccd6449e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[0.21410231, 0.21410231, 0.21410231, ..., 0.21410231, 0.21410231,\n",
              "        0.21410231],\n",
              "       [0.18127217, 0.18127217, 0.18127217, ..., 0.18127217, 0.18127217,\n",
              "        0.18127217],\n",
              "       [0.20194261, 0.20194261, 0.20194261, ..., 0.20194261, 0.20194261,\n",
              "        0.20194261],\n",
              "       [0.19286523, 0.19286523, 0.19286523, ..., 0.19286523, 0.19286523,\n",
              "        0.19286523]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>energy_error</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.06449 -0.04859 ... -0.02542</div><input id='attrs-586062d7-1922-46ff-bc7b-c84e0d38af86' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-586062d7-1922-46ff-bc7b-c84e0d38af86' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0899a10d-9b8d-458a-b573-c329a38bac95' class='xr-var-data-in' type='checkbox'><label for='data-0899a10d-9b8d-458a-b573-c329a38bac95' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[ 6.44902396e-02, -4.85883401e-02,  1.04099614e+00, ...,\n",
              "        -1.18607121e-01, -3.31936614e-02,  3.48059004e-02],\n",
              "       [-2.96809235e-01,  9.25780101e-01, -3.03911615e-01, ...,\n",
              "         0.00000000e+00, -1.68275672e-01,  7.19124745e-02],\n",
              "       [ 7.67533582e-02,  3.67079729e-01, -6.64869733e-01, ...,\n",
              "        -1.09031260e-01,  6.60397468e-04,  1.32124686e-01],\n",
              "       [-5.59896798e-02, -1.17084920e-01, -3.70468835e-02, ...,\n",
              "        -9.44124803e-02, -1.63769653e-01, -2.54180602e-02]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>perf_counter_diff</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.004054 0.002101 ... 0.002761</div><input id='attrs-dc388f66-3fc9-4e6d-957e-fe127b97484b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-dc388f66-3fc9-4e6d-957e-fe127b97484b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-35caaf2b-3e30-4bcc-9d3d-f46fcaf3de82' class='xr-var-data-in' type='checkbox'><label for='data-35caaf2b-3e30-4bcc-9d3d-f46fcaf3de82' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[0.00405446, 0.00210149, 0.00164972, ..., 0.00409464, 0.00210351,\n",
              "        0.0016145 ],\n",
              "       [0.00214102, 0.00067469, 0.00185378, ..., 0.00034201, 0.00209537,\n",
              "        0.00207347],\n",
              "       [0.00139192, 0.00216697, 0.00066885, ..., 0.00210325, 0.0011171 ,\n",
              "        0.00215258],\n",
              "       [0.00218044, 0.00213548, 0.00213762, ..., 0.00211992, 0.00140228,\n",
              "        0.00276102]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>step_size</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.2777 0.2777 ... 0.1915 0.1915</div><input id='attrs-e348b9a9-3a88-4a2a-b39f-be94cea5d500' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e348b9a9-3a88-4a2a-b39f-be94cea5d500' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6eb38cba-a0e2-466e-a1a0-7799cfa58aa3' class='xr-var-data-in' type='checkbox'><label for='data-6eb38cba-a0e2-466e-a1a0-7799cfa58aa3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[0.27765586, 0.27765586, 0.27765586, ..., 0.27765586, 0.27765586,\n",
              "        0.27765586],\n",
              "       [0.25041055, 0.25041055, 0.25041055, ..., 0.25041055, 0.25041055,\n",
              "        0.25041055],\n",
              "       [0.15212763, 0.15212763, 0.15212763, ..., 0.15212763, 0.15212763,\n",
              "        0.15212763],\n",
              "       [0.19153431, 0.19153431, 0.19153431, ..., 0.19153431, 0.19153431,\n",
              "        0.19153431]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>index_in_trajectory</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>8 3 -4 -2 1 -2 7 ... 4 -3 17 8 4 -5</div><input id='attrs-40a81f16-63ce-43fb-8160-41eb45c6a7f6' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-40a81f16-63ce-43fb-8160-41eb45c6a7f6' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-fcf02098-09dc-4069-a6c4-596c7f839c8a' class='xr-var-data-in' type='checkbox'><label for='data-fcf02098-09dc-4069-a6c4-596c7f839c8a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[  8,   3,  -4, ..., -12,   7,  -3],\n",
              "       [ 10,  -1,   4, ...,   0,   3,   4],\n",
              "       [  3, -11,  -2, ...,   1,   7,   9],\n",
              "       [-15,  11, -14, ...,   8,   4,  -5]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>energy</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>553.0 552.5 555.8 ... 555.8 554.2</div><input id='attrs-ea32de63-c21d-487b-a59a-e9882479aa28' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ea32de63-c21d-487b-a59a-e9882479aa28' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7a69709b-40c8-4b3c-971d-262c3e7863a2' class='xr-var-data-in' type='checkbox'><label for='data-7a69709b-40c8-4b3c-971d-262c3e7863a2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[553.02743322, 552.48556418, 555.84017244, ..., 555.74981982,\n",
              "        557.06686193, 554.75665152],\n",
              "       [553.39931435, 553.83877898, 553.96985773, ..., 556.06764694,\n",
              "        552.90222932, 552.2187238 ],\n",
              "       [555.91914371, 556.50403107, 553.66722859, ..., 555.0209278 ,\n",
              "        552.40829473, 555.03732914],\n",
              "       [553.77414254, 552.3363219 , 552.80792287, ..., 556.30761621,\n",
              "        555.75812829, 554.18283208]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>reached_max_treedepth</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>False False False ... False False</div><input id='attrs-79a767dd-289d-4eaf-9325-473ad0d87d42' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-79a767dd-289d-4eaf-9325-473ad0d87d42' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6f290852-fb28-4934-8af3-66b32f8894f5' class='xr-var-data-in' type='checkbox'><label for='data-6f290852-fb28-4934-8af3-66b32f8894f5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[False, False, False, ..., False, False, False],\n",
              "       [False, False, False, ..., False, False, False],\n",
              "       [False, False, False, ..., False, False, False],\n",
              "       [False, False, False, ..., False, False, False]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>acceptance_rate</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.8256 0.9937 ... 0.9964 0.9973</div><input id='attrs-7aa6844c-0a34-41c5-af6c-95a51d2b5ff8' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7aa6844c-0a34-41c5-af6c-95a51d2b5ff8' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b81fb7f8-f470-4b7e-a60b-db56e5f5defd' class='xr-var-data-in' type='checkbox'><label for='data-b81fb7f8-f470-4b7e-a60b-db56e5f5defd' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[0.82557061, 0.99372472, 0.55753361, ..., 0.87696654, 0.53749814,\n",
              "        0.98161322],\n",
              "       [0.90387437, 0.51659399, 0.9823152 , ..., 0.01415906, 0.98494782,\n",
              "        0.84755487],\n",
              "       [0.93974678, 0.78777066, 0.80666837, ..., 0.9953321 , 0.8867566 ,\n",
              "        0.93134589],\n",
              "       [0.78601988, 1.        , 0.99511529, ..., 0.97796333, 0.99641444,\n",
              "        0.99727791]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>tree_depth</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>5 4 4 2 1 4 5 3 ... 5 4 4 3 5 4 3 4</div><input id='attrs-d3a70bac-5df6-404e-ac9c-01398f0e8c3f' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d3a70bac-5df6-404e-ac9c-01398f0e8c3f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-34f02538-fab8-4b4d-8776-2c5cf8a36a09' class='xr-var-data-in' type='checkbox'><label for='data-34f02538-fab8-4b4d-8776-2c5cf8a36a09' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[5, 4, 4, ..., 5, 4, 4],\n",
              "       [4, 2, 4, ..., 1, 4, 4],\n",
              "       [4, 4, 2, ..., 4, 3, 4],\n",
              "       [4, 4, 4, ..., 4, 3, 4]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>largest_eigval</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>nan nan nan nan ... nan nan nan nan</div><input id='attrs-013d71b2-8b63-499e-8cc6-8b40e09883da' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-013d71b2-8b63-499e-8cc6-8b40e09883da' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0fc097bc-0d48-47be-be0d-4cbd23eba24b' class='xr-var-data-in' type='checkbox'><label for='data-0fc097bc-0d48-47be-be0d-4cbd23eba24b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[nan, nan, nan, ..., nan, nan, nan],\n",
              "       [nan, nan, nan, ..., nan, nan, nan],\n",
              "       [nan, nan, nan, ..., nan, nan, nan],\n",
              "       [nan, nan, nan, ..., nan, nan, nan]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>n_steps</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>31.0 15.0 11.0 ... 15.0 7.0 15.0</div><input id='attrs-3fc67f90-86b2-474f-848d-b3ace78df399' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3fc67f90-86b2-474f-848d-b3ace78df399' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3b89f319-297d-4d68-956c-0f60a59ebcda' class='xr-var-data-in' type='checkbox'><label for='data-3b89f319-297d-4d68-956c-0f60a59ebcda' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[31., 15., 11., ..., 31., 15., 11.],\n",
              "       [15.,  3., 13., ...,  1., 15., 15.],\n",
              "       [ 9., 15.,  3., ..., 15.,  7., 15.],\n",
              "       [15., 15., 15., ..., 15.,  7., 15.]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lp</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-552.2 -551.7 ... -554.0 -552.3</div><input id='attrs-7ae8ee6a-8c4a-4dc5-b1a2-5055ddaaba5e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7ae8ee6a-8c4a-4dc5-b1a2-5055ddaaba5e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c7d1b2a3-93d7-482a-8111-4caf6f865479' class='xr-var-data-in' type='checkbox'><label for='data-c7d1b2a3-93d7-482a-8111-4caf6f865479' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-552.17697361, -551.72919094, -554.98009072, ..., -553.5834406 ,\n",
              "        -553.89643148, -552.9270862 ],\n",
              "       [-551.87239983, -553.56409182, -552.95215919, ..., -552.14430407,\n",
              "        -551.63998248, -551.8022062 ],\n",
              "       [-554.97414665, -553.55184797, -552.86120171, ..., -551.8932487 ,\n",
              "        -551.89827933, -553.82389683],\n",
              "       [-552.29406193, -552.11614535, -552.15542383, ..., -555.62319744,\n",
              "        -554.00604697, -552.27723243]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>diverging</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>bool</div><div class='xr-var-preview xr-preview'>False False False ... False False</div><input id='attrs-18265e7f-85c3-4fd6-8c12-a39e5aaeb499' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-18265e7f-85c3-4fd6-8c12-a39e5aaeb499' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e37cc752-5354-4f60-8528-fe492467def1' class='xr-var-data-in' type='checkbox'><label for='data-e37cc752-5354-4f60-8528-fe492467def1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[False, False, False, ..., False, False, False],\n",
              "       [False, False, False, ..., False, False, False],\n",
              "       [False, False, False, ..., False, False, False],\n",
              "       [False, False, False, ..., False, False, False]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-2ddb2bad-9015-439b-93be-6b65adc68e79' class='xr-section-summary-in' type='checkbox'  checked><label for='section-2ddb2bad-9015-439b-93be-6b65adc68e79' class='xr-section-summary' >Attributes: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:48:34.476368</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd><dt><span>sampling_time :</span></dt><dd>19.658550024032593</dd><dt><span>tuning_steps :</span></dt><dd>1000</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_observed_data34e4f19d-a8d0-4273-b16d-f794f5f2f27d\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_observed_data34e4f19d-a8d0-4273-b16d-f794f5f2f27d\" class = \"xr-section-summary\">observed_data</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:      (y_est_dim_0: 174)\n",
              "Coordinates:\n",
              "  * y_est_dim_0  (y_est_dim_0) int64 0 1 2 3 4 5 6 ... 168 169 170 171 172 173\n",
              "Data variables:\n",
              "    y_est        (y_est_dim_0) float64 47.0 40.0 40.0 46.0 ... 35.0 38.0 39.0\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:48:34.490119\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-1581e6c3-d5e3-4339-bb1f-e842f601324a' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-1581e6c3-d5e3-4339-bb1f-e842f601324a' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>y_est_dim_0</span>: 174</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-78b6067f-7cb4-41ec-9036-754b8c6b64e5' class='xr-section-summary-in' type='checkbox'  checked><label for='section-78b6067f-7cb4-41ec-9036-754b8c6b64e5' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>y_est_dim_0</span></div><div class='xr-var-dims'>(y_est_dim_0)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 ... 169 170 171 172 173</div><input id='attrs-72f4ee4d-d71b-4934-967f-6ddcf2d236f7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-72f4ee4d-d71b-4934-967f-6ddcf2d236f7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-64301581-ea40-4735-a2e2-cd1f0ae81296' class='xr-var-data-in' type='checkbox'><label for='data-64301581-ea40-4735-a2e2-cd1f0ae81296' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,\n",
              "        14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,\n",
              "        28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,\n",
              "        42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,\n",
              "        56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,\n",
              "        70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,\n",
              "        84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,\n",
              "        98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\n",
              "       112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,\n",
              "       126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n",
              "       140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n",
              "       154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,\n",
              "       168, 169, 170, 171, 172, 173])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-e5df781a-0f28-49a9-8a9d-0d90dcfbfb9a' class='xr-section-summary-in' type='checkbox'  checked><label for='section-e5df781a-0f28-49a9-8a9d-0d90dcfbfb9a' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>y_est</span></div><div class='xr-var-dims'>(y_est_dim_0)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>47.0 40.0 40.0 ... 35.0 38.0 39.0</div><input id='attrs-faf0369c-2cd8-4b25-8717-24a7302a15f7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-faf0369c-2cd8-4b25-8717-24a7302a15f7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b9167334-6803-4101-9134-3201956a2a9a' class='xr-var-data-in' type='checkbox'><label for='data-b9167334-6803-4101-9134-3201956a2a9a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([47., 40., 40., 46., 50., 43., 36., 35., 47., 50., 44., 34., 26.,\n",
              "       42., 48., 41., 46., 43., 40., 52., 46., 41., 46., 40., 42., 41.,\n",
              "       48., 49., 46., 35., 37., 45., 37., 36., 35., 45., 35., 40., 35.,\n",
              "       49., 39., 38., 45., 40., 37., 36., 42., 32., 40., 45., 33., 45.,\n",
              "       42., 40., 23., 32., 50., 44., 40., 36., 28., 51., 40., 33., 29.,\n",
              "       37., 38., 38., 26., 40., 41., 43., 44., 38., 34., 46., 43., 42.,\n",
              "       43., 40., 33., 44., 38., 40., 43., 31., 51., 50., 42., 41., 34.,\n",
              "       38., 37., 42., 41., 27., 46., 33., 35., 48., 39., 41., 43., 31.,\n",
              "       40., 38., 43., 38., 36., 41., 48., 44., 28., 36., 32., 42., 30.,\n",
              "       40., 43., 36., 38., 25., 41., 35., 36., 45., 35., 36., 33., 42.,\n",
              "       28., 43., 44., 38., 31., 33., 29., 43., 47., 42., 48., 27., 36.,\n",
              "       31., 48., 34., 40., 32., 46., 34., 39., 36., 37., 39., 47., 44.,\n",
              "       37., 40., 50., 35., 42., 24., 38., 41., 45., 35., 44., 46., 39.,\n",
              "       52., 33., 35., 38., 39.])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-0d5c6547-c910-4cae-a5c7-3c250c358ea4' class='xr-section-summary-in' type='checkbox'  checked><label for='section-0d5c6547-c910-4cae-a5c7-3c250c358ea4' class='xr-section-summary' >Attributes: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:48:34.490119</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_constant_data6a89915f-b812-4c26-a4ee-f9e61eb28083\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_constant_data6a89915f-b812-4c26-a4ee-f9e61eb28083\" class = \"xr-section-summary\">constant_data</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:  (x_dim_0: 174)\n",
              "Coordinates:\n",
              "  * x_dim_0  (x_dim_0) int64 0 1 2 3 4 5 6 7 ... 166 167 168 169 170 171 172 173\n",
              "Data variables:\n",
              "    x        (x_dim_0) int32 38 43 31 35 45 42 41 58 ... 29 36 43 32 42 42 39 33\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:48:34.494412\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-9723ba37-2375-40cb-ae11-962737cc6355' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-9723ba37-2375-40cb-ae11-962737cc6355' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>x_dim_0</span>: 174</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-e0273b69-33df-49d8-8c64-4a7cf2664efb' class='xr-section-summary-in' type='checkbox'  checked><label for='section-e0273b69-33df-49d8-8c64-4a7cf2664efb' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>x_dim_0</span></div><div class='xr-var-dims'>(x_dim_0)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 ... 169 170 171 172 173</div><input id='attrs-27bac459-f994-405c-ba77-d1756f25055d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-27bac459-f994-405c-ba77-d1756f25055d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-690498fe-f309-4096-afe9-bf821c76afd8' class='xr-var-data-in' type='checkbox'><label for='data-690498fe-f309-4096-afe9-bf821c76afd8' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,\n",
              "        14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,\n",
              "        28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,\n",
              "        42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,\n",
              "        56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,\n",
              "        70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,\n",
              "        84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,\n",
              "        98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\n",
              "       112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,\n",
              "       126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n",
              "       140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n",
              "       154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,\n",
              "       168, 169, 170, 171, 172, 173])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-5f4bb917-1847-4c63-b669-f39dc12938d7' class='xr-section-summary-in' type='checkbox'  checked><label for='section-5f4bb917-1847-4c63-b669-f39dc12938d7' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>x</span></div><div class='xr-var-dims'>(x_dim_0)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>38 43 31 35 45 ... 32 42 42 39 33</div><input id='attrs-64f2070e-8cb5-4cf4-90db-198e9dac02d1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-64f2070e-8cb5-4cf4-90db-198e9dac02d1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6400a016-6948-4bf1-a251-60e864c0cfb0' class='xr-var-data-in' type='checkbox'><label for='data-6400a016-6948-4bf1-a251-60e864c0cfb0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([38, 43, 31, 35, 45, 42, 41, 58, 47, 33, 40, 34, 45, 38, 31, 40, 37,\n",
              "       36, 37, 38, 35, 34, 44, 44, 36, 36, 39, 40, 30, 47, 35, 48, 42, 42,\n",
              "       40, 35, 36, 28, 47, 27, 49, 41, 37, 37, 41, 49, 54, 50, 36, 43, 35,\n",
              "       33, 40, 39, 39, 46, 26, 49, 36, 42, 43, 33, 46, 46, 51, 43, 38, 44,\n",
              "       49, 26, 31, 50, 47, 42, 46, 36, 40, 33, 33, 50, 43, 30, 36, 37, 30,\n",
              "       42, 39, 46, 39, 28, 52, 26, 43, 38, 38, 46, 39, 44, 41, 44, 42, 30,\n",
              "       39, 45, 46, 38, 36, 42, 39, 41, 37, 32, 49, 40, 42, 43, 48, 47, 35,\n",
              "       44, 35, 48, 38, 45, 34, 30, 35, 45, 42, 32, 39, 38, 33, 35, 36, 36,\n",
              "       46, 43, 26, 34, 37, 44, 41, 50, 22, 43, 41, 57, 43, 45, 39, 43, 41,\n",
              "       57, 35, 43, 39, 38, 33, 55, 38, 46, 42, 48, 26, 40, 29, 36, 43, 32,\n",
              "       42, 42, 39, 33], dtype=int32)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-7015179f-006b-4723-8874-8c4c1417ca07' class='xr-section-summary-in' type='checkbox'  checked><label for='section-7015179f-006b-4723-8874-8c4c1417ca07' class='xr-section-summary' >Attributes: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:48:34.494412</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "              </ul>\n",
              "            </div>\n",
              "            <style> /* CSS stylesheet for displaying InferenceData objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-sections.group-sections {\n",
              "  grid-template-columns: auto;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt, dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              ".xr-wrap{width:700px!important;} </style>"
            ],
            "text/plain": [
              "Inference data with groups:\n",
              "\t> posterior\n",
              "\t> sample_stats\n",
              "\t> observed_data\n",
              "\t> constant_data"
            ]
          },
          "execution_count": 11,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "trace"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "collapsed": false,
        "id": "7E023B993D0C4294AA65B4ADDF7A52A7",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:  (chain: 4, draw: 5000)\n",
              "Coordinates:\n",
              "  * chain    (chain) int64 0 1 2 3\n",
              "  * draw     (draw) int64 0 1 2 3 4 5 6 7 ... 4993 4994 4995 4996 4997 4998 4999\n",
              "Data variables:\n",
              "    beta_0   (chain, draw) float64 58.87 58.57 57.45 58.36 ... 64.75 63.68 61.97\n",
              "    beta_1   (chain, draw) float64 -0.4782 -0.4796 -0.4733 ... -0.606 -0.5615\n",
              "    sigma    (chain, draw) float64 5.695 5.506 5.278 5.206 ... 5.174 5.181 5.28\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:48:34.424207\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0\n",
              "    sampling_time:              19.658550024032593\n",
              "    tuning_steps:               1000</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-ae40df9e-f6ca-435b-a7e6-cfd0a05762eb' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-ae40df9e-f6ca-435b-a7e6-cfd0a05762eb' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>chain</span>: 4</li><li><span class='xr-has-index'>draw</span>: 5000</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-eaa43657-81c6-492b-97e8-3c4fa7cbc7fd' class='xr-section-summary-in' type='checkbox'  checked><label for='section-eaa43657-81c6-492b-97e8-3c4fa7cbc7fd' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>chain</span></div><div class='xr-var-dims'>(chain)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-894cc018-2336-440f-a1a9-33c6454405ed' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-894cc018-2336-440f-a1a9-33c6454405ed' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ad011a7e-6fba-4a86-bbf5-8e55edf0faf9' class='xr-var-data-in' type='checkbox'><label for='data-ad011a7e-6fba-4a86-bbf5-8e55edf0faf9' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>draw</span></div><div class='xr-var-dims'>(draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 ... 4996 4997 4998 4999</div><input id='attrs-76705c21-f568-485c-bcb6-d5797221424a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-76705c21-f568-485c-bcb6-d5797221424a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a78df2f0-6eed-45ca-8315-6c80f80b6f5e' class='xr-var-data-in' type='checkbox'><label for='data-a78df2f0-6eed-45ca-8315-6c80f80b6f5e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([   0,    1,    2, ..., 4997, 4998, 4999])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-eb5090e3-fa5f-407d-9c41-362f916edbfa' class='xr-section-summary-in' type='checkbox'  checked><label for='section-eb5090e3-fa5f-407d-9c41-362f916edbfa' class='xr-section-summary' >Data variables: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>beta_0</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>58.87 58.57 57.45 ... 63.68 61.97</div><input id='attrs-4eba07ba-44fd-43be-8765-3eafebe39d4e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-4eba07ba-44fd-43be-8765-3eafebe39d4e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a3a194d3-8c9f-4b78-a87c-ba47e9238d37' class='xr-var-data-in' type='checkbox'><label for='data-a3a194d3-8c9f-4b78-a87c-ba47e9238d37' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[58.86695078, 58.57345176, 57.44999204, ..., 56.87899891,\n",
              "        55.18460974, 56.52524464],\n",
              "       [60.33121294, 60.48527833, 60.17064049, ..., 60.95351092,\n",
              "        59.88658912, 59.21138754],\n",
              "       [62.85570065, 58.3407012 , 58.76709596, ..., 58.91063931,\n",
              "        59.11366693, 56.22569953],\n",
              "       [60.60435197, 60.45496042, 59.04095076, ..., 64.74854344,\n",
              "        63.67703222, 61.97186055]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>beta_1</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-0.4782 -0.4796 ... -0.606 -0.5615</div><input id='attrs-3bc07e8f-8480-4f8f-b677-9d953ac54567' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3bc07e8f-8480-4f8f-b677-9d953ac54567' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-719c1b69-46f4-429b-8968-f645b9adb71f' class='xr-var-data-in' type='checkbox'><label for='data-719c1b69-46f4-429b-8968-f645b9adb71f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[-0.47815269, -0.47960299, -0.47329089, ..., -0.42593683,\n",
              "        -0.39486588, -0.42089611],\n",
              "       [-0.51268782, -0.50433481, -0.49923909, ..., -0.52666009,\n",
              "        -0.51493146, -0.50053525],\n",
              "       [-0.58902235, -0.48703451, -0.47460662, ..., -0.4849174 ,\n",
              "        -0.48953898, -0.42489017],\n",
              "       [-0.53537063, -0.52778124, -0.49040009, ..., -0.637929  ,\n",
              "        -0.60601105, -0.56154305]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>sigma</span></div><div class='xr-var-dims'>(chain, draw)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.695 5.506 5.278 ... 5.181 5.28</div><input id='attrs-570ac32b-b79c-4f2a-8436-d73c7599000f' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-570ac32b-b79c-4f2a-8436-d73c7599000f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6d67b72e-ce43-4a66-bb35-45bece9bb3c6' class='xr-var-data-in' type='checkbox'><label for='data-6d67b72e-ce43-4a66-bb35-45bece9bb3c6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[5.69492348, 5.50571801, 5.27834405, ..., 5.1234742 , 5.36884129,\n",
              "        5.37981517],\n",
              "       [5.36547203, 5.35886386, 5.5625251 , ..., 5.33677941, 5.49468206,\n",
              "        5.44005124],\n",
              "       [6.22619008, 5.13127956, 5.06342675, ..., 5.21723714, 5.2071525 ,\n",
              "        5.07363044],\n",
              "       [5.21726127, 5.76379417, 5.13829373, ..., 5.17424356, 5.181334  ,\n",
              "        5.27979956]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-26853264-6dbf-45f8-8904-fe26f8e578d8' class='xr-section-summary-in' type='checkbox'  checked><label for='section-26853264-6dbf-45f8-8904-fe26f8e578d8' class='xr-section-summary' >Attributes: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:48:34.424207</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd><dt><span>sampling_time :</span></dt><dd>19.658550024032593</dd><dt><span>tuning_steps :</span></dt><dd>1000</dd></dl></div></li></ul></div></div>"
            ],
            "text/plain": [
              "<xarray.Dataset>\n",
              "Dimensions:  (chain: 4, draw: 5000)\n",
              "Coordinates:\n",
              "  * chain    (chain) int64 0 1 2 3\n",
              "  * draw     (draw) int64 0 1 2 3 4 5 6 7 ... 4993 4994 4995 4996 4997 4998 4999\n",
              "Data variables:\n",
              "    beta_0   (chain, draw) float64 58.87 58.57 57.45 58.36 ... 64.75 63.68 61.97\n",
              "    beta_1   (chain, draw) float64 -0.4782 -0.4796 -0.4733 ... -0.606 -0.5615\n",
              "    sigma    (chain, draw) float64 5.695 5.506 5.278 5.206 ... 5.174 5.181 5.28\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:48:34.424207\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0\n",
              "    sampling_time:              19.658550024032593\n",
              "    tuning_steps:               1000"
            ]
          },
          "execution_count": 12,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "trace.posterior"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "metadata": {
        "collapsed": false,
        "id": "EA84A30627134ED5A18FDA09C8EF99CE",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;beta_0&#x27; (chain: 4, draw: 5000)&gt;\n",
              "array([[58.86695078, 58.57345176, 57.44999204, ..., 56.87899891,\n",
              "        55.18460974, 56.52524464],\n",
              "       [60.33121294, 60.48527833, 60.17064049, ..., 60.95351092,\n",
              "        59.88658912, 59.21138754],\n",
              "       [62.85570065, 58.3407012 , 58.76709596, ..., 58.91063931,\n",
              "        59.11366693, 56.22569953],\n",
              "       [60.60435197, 60.45496042, 59.04095076, ..., 64.74854344,\n",
              "        63.67703222, 61.97186055]])\n",
              "Coordinates:\n",
              "  * chain    (chain) int64 0 1 2 3\n",
              "  * draw     (draw) int64 0 1 2 3 4 5 6 7 ... 4993 4994 4995 4996 4997 4998 4999</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'beta_0'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>chain</span>: 4</li><li><span class='xr-has-index'>draw</span>: 5000</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-d9b09430-4476-43dc-8477-134fa320b87b' class='xr-array-in' type='checkbox' checked><label for='section-d9b09430-4476-43dc-8477-134fa320b87b' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>58.87 58.57 57.45 58.36 58.28 57.42 ... 58.33 62.97 64.75 63.68 61.97</span></div><div class='xr-array-data'><pre>array([[58.86695078, 58.57345176, 57.44999204, ..., 56.87899891,\n",
              "        55.18460974, 56.52524464],\n",
              "       [60.33121294, 60.48527833, 60.17064049, ..., 60.95351092,\n",
              "        59.88658912, 59.21138754],\n",
              "       [62.85570065, 58.3407012 , 58.76709596, ..., 58.91063931,\n",
              "        59.11366693, 56.22569953],\n",
              "       [60.60435197, 60.45496042, 59.04095076, ..., 64.74854344,\n",
              "        63.67703222, 61.97186055]])</pre></div></div></li><li class='xr-section-item'><input id='section-1aae6dbe-9180-49ad-aafa-3608cee4e746' class='xr-section-summary-in' type='checkbox'  checked><label for='section-1aae6dbe-9180-49ad-aafa-3608cee4e746' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>chain</span></div><div class='xr-var-dims'>(chain)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-b6b6ef31-e000-4042-bcc5-3e53e1b01dbc' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b6b6ef31-e000-4042-bcc5-3e53e1b01dbc' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a7fff40f-43de-41be-91da-1a4c6fde93a4' class='xr-var-data-in' type='checkbox'><label for='data-a7fff40f-43de-41be-91da-1a4c6fde93a4' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>draw</span></div><div class='xr-var-dims'>(draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 ... 4996 4997 4998 4999</div><input id='attrs-ea663b84-46cb-402e-b718-44268087daae' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ea663b84-46cb-402e-b718-44268087daae' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-bc2da38d-4b7e-42b0-9cf9-c6d52c148391' class='xr-var-data-in' type='checkbox'><label for='data-bc2da38d-4b7e-42b0-9cf9-c6d52c148391' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([   0,    1,    2, ..., 4997, 4998, 4999])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-d3e8e867-91bf-49f4-8ebe-683350513930' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d3e8e867-91bf-49f4-8ebe-683350513930' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
            ],
            "text/plain": [
              "<xarray.DataArray 'beta_0' (chain: 4, draw: 5000)>\n",
              "array([[58.86695078, 58.57345176, 57.44999204, ..., 56.87899891,\n",
              "        55.18460974, 56.52524464],\n",
              "       [60.33121294, 60.48527833, 60.17064049, ..., 60.95351092,\n",
              "        59.88658912, 59.21138754],\n",
              "       [62.85570065, 58.3407012 , 58.76709596, ..., 58.91063931,\n",
              "        59.11366693, 56.22569953],\n",
              "       [60.60435197, 60.45496042, 59.04095076, ..., 64.74854344,\n",
              "        63.67703222, 61.97186055]])\n",
              "Coordinates:\n",
              "  * chain    (chain) int64 0 1 2 3\n",
              "  * draw     (draw) int64 0 1 2 3 4 5 6 7 ... 4993 4994 4995 4996 4997 4998 4999"
            ]
          },
          "execution_count": 13,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "trace.posterior['beta_0']"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {
        "collapsed": false,
        "id": "65E8FFCA4760495DB1F9710072A2D37C",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;beta_0&#x27; ()&gt;\n",
              "array(58.39827502)\n",
              "Coordinates:\n",
              "    chain    int64 0\n",
              "    draw     int64 10</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'beta_0'</div></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-a3543dce-9107-4430-a8ff-892977fb972f' class='xr-array-in' type='checkbox' checked><label for='section-a3543dce-9107-4430-a8ff-892977fb972f' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>58.4</span></div><div class='xr-array-data'><pre>array(58.39827502)</pre></div></div></li><li class='xr-section-item'><input id='section-a5c215d8-7b1f-4254-a240-9f04811bd343' class='xr-section-summary-in' type='checkbox'  checked><label for='section-a5c215d8-7b1f-4254-a240-9f04811bd343' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>chain</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0</div><input id='attrs-b2700fdb-e856-4c37-8e4d-3a8f580d56d1' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b2700fdb-e856-4c37-8e4d-3a8f580d56d1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a1feb8e6-2811-48d6-ab71-88db421a9e45' class='xr-var-data-in' type='checkbox'><label for='data-a1feb8e6-2811-48d6-ab71-88db421a9e45' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(0)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>draw</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>10</div><input id='attrs-7b0a5b62-b0dd-43b8-9e31-1d82e103edaa' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7b0a5b62-b0dd-43b8-9e31-1d82e103edaa' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-09a947ad-e489-442a-b5fd-bdbaa65b8aea' class='xr-var-data-in' type='checkbox'><label for='data-09a947ad-e489-442a-b5fd-bdbaa65b8aea' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(10)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c5aaac88-3d29-4d31-a339-8e99447eb659' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-c5aaac88-3d29-4d31-a339-8e99447eb659' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
            ],
            "text/plain": [
              "<xarray.DataArray 'beta_0' ()>\n",
              "array(58.39827502)\n",
              "Coordinates:\n",
              "    chain    int64 0\n",
              "    draw     int64 10"
            ]
          },
          "execution_count": 14,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "trace.posterior['beta_0'][0, 10]"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "CD20101C82A9473AA5A238411D5AA548",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "使用`az.plot_trace()`可视化参数的后验分布"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "metadata": {
        "collapsed": false,
        "id": "2FCFE5185166427BA8F82960387A4E7D",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([[<Axes: title={'center': 'beta_0'}>,\n",
              "        <Axes: title={'center': 'beta_0'}>],\n",
              "       [<Axes: title={'center': 'beta_1'}>,\n",
              "        <Axes: title={'center': 'beta_1'}>],\n",
              "       [<Axes: title={'center': 'sigma'}>,\n",
              "        <Axes: title={'center': 'sigma'}>]], dtype=object)"
            ]
          },
          "execution_count": 15,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/2FCFE5185166427BA8F82960387A4E7D/s3qz9c95nz.png\">"
            ],
            "text/plain": [
              "<Figure size 1500x1000 with 6 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "az.plot_trace(trace, figsize=(15,10),compact=False,legend=True)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "CDCEA7A087AB4701909D1DB0F8AF4168",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 解释后验  \n",
        "\n",
        "我们共得到20000对$\\beta_0$和$\\beta_1$值，可以通过`az.summary()`总结参数的基本信息  \n",
        "\n",
        "- 这其中包括了对于模型的诊断信息 ess_bulk 和 r_hat (当然你可以结合可视化进行诊断)。  \n",
        "\t- 其中，各参数的 r_hat 均接近于 1；  \n",
        "\t- 各参数的ess_bulk 均大于 400，并且有效样本量占比 (6000/20000)=0.3，大于0.1(即10%)。  \n",
        " \n",
        "- 同时该结果也包含了参数的均值和HDI。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "metadata": {
        "collapsed": false,
        "id": "A0F9160CF5AC4C10A2489DF4548A914F",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>mean</th>\n",
              "      <th>sd</th>\n",
              "      <th>hdi_3%</th>\n",
              "      <th>hdi_97%</th>\n",
              "      <th>mcse_mean</th>\n",
              "      <th>mcse_sd</th>\n",
              "      <th>ess_bulk</th>\n",
              "      <th>ess_tail</th>\n",
              "      <th>r_hat</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>beta_0</th>\n",
              "      <td>59.898</td>\n",
              "      <td>2.175</td>\n",
              "      <td>55.967</td>\n",
              "      <td>64.087</td>\n",
              "      <td>0.029</td>\n",
              "      <td>0.020</td>\n",
              "      <td>5770.0</td>\n",
              "      <td>7559.0</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>beta_1</th>\n",
              "      <td>-0.510</td>\n",
              "      <td>0.054</td>\n",
              "      <td>-0.612</td>\n",
              "      <td>-0.410</td>\n",
              "      <td>0.001</td>\n",
              "      <td>0.001</td>\n",
              "      <td>5788.0</td>\n",
              "      <td>7482.0</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>sigma</th>\n",
              "      <td>5.498</td>\n",
              "      <td>0.302</td>\n",
              "      <td>4.951</td>\n",
              "      <td>6.081</td>\n",
              "      <td>0.003</td>\n",
              "      <td>0.002</td>\n",
              "      <td>9409.0</td>\n",
              "      <td>8764.0</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "          mean     sd  hdi_3%  hdi_97%  mcse_mean  mcse_sd  ess_bulk  \\\n",
              "beta_0  59.898  2.175  55.967   64.087      0.029    0.020    5770.0   \n",
              "beta_1  -0.510  0.054  -0.612   -0.410      0.001    0.001    5788.0   \n",
              "sigma    5.498  0.302   4.951    6.081      0.003    0.002    9409.0   \n",
              "\n",
              "        ess_tail  r_hat  \n",
              "beta_0    7559.0    1.0  \n",
              "beta_1    7482.0    1.0  \n",
              "sigma     8764.0    1.0  "
            ]
          },
          "execution_count": 16,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "az.summary(trace)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "250299B120624E5389901C11BF05EB19",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "* 我们可以使用均值来理解生成的后验分布，通过上表我们知道  \n",
        "\n",
        "\t*  $\\beta_0$= 59.90 *(压力水平为0时的自我控制水平，意义不大在此不考虑)*  \n",
        "\n",
        "\t*  $\\beta_1$ = -0.51  \n",
        "\n",
        "\t*  我们可以将其解释为，压力水平每增加1分，自我控制水平下降0.51分  \n",
        "\n",
        "* 但从上表我们也知道参数的后验分布存在不确定性，参数均值生成的回归线只是其中之一  \n",
        "\n",
        "\t* 那么我们可以通过20000对参数值，生成20000条回归线"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "CAFB7BFF6F3D453FAB65806E7EA412EC",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 后验预测  \n",
        "\n",
        "### 对变量关系的预测  \n",
        "\n",
        "1. 使用单条回归线来表示`压力`与`自我控制水平`的关系存在不确定性，那么可以结合后验采样的所有结果，观察二者关系"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "8523193BE2C84FA8864D51B0F97E218A",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 练习  \n",
        "\n",
        "根据 **先验预测检验可视化预测结果**的思路，对于后验预测结果进行可视化。  \n",
        "\n",
        "1. 使用真实数据中的自变量df.stress  \n",
        "2. 根据 20000对参数，与自变量进行组合，生成了20000条回归线  \n",
        "3. 绘制后验预测结果  \n",
        "\n",
        "*(代码需运行3分钟左右)*"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 33,
      "metadata": {
        "collapsed": false,
        "id": "AACF3F65A97F4CED97F2141F7D5FEB5D",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "# 通过np.arange设置压力分数，从 14,15...70。\n",
        "x_sim = np.arange(start=14,stop=71,step=1)\n",
        "x_value = xr.DataArray(x_sim)\n",
        "\n",
        "##---------------------------------------------------------------------------\n",
        "#      20000对参数与自变量进行组合，生成了20000条回归线\n",
        "#      提示：基本公式为 y_model = beta_0 + beta_1 * x\n",
        "#      提示：但需要对参数的表达进行修改\n",
        "#           如：beta_0 = trace.posterior[\"beta_0\"]\n",
        "#---------------------------------------------------------------------------\n",
        "y_model = ...\n",
        "\n",
        "\n",
        "## 为了画图时反应所有链合并的结果，将y_sim的chain和draw融合到一起\n",
        "y_sim_re = y_model.stack(sample=(\"chain\", \"draw\"))\n",
        "\n",
        "# 绘制回归线条\n",
        "plt.plot(x_value, y_sim_re, c=\"gray\", alpha=0.01)\n",
        "\n",
        "# 绘制真实数据的散点图\n",
        "plt.scatter(trace.constant_data.x,trace.observed_data.y_est,c=\"r\", label=\"observed data\")\n",
        "\n",
        "# 设置标题等\n",
        "plt.title(\"posterior predictive check\")\n",
        "plt.xlabel(\"Stress\")\n",
        "plt.ylabel(\"Self control\")\n",
        "plt.legend()\n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "7C7A9D361C41449D8B8AAA94D50FFB68",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**使用`plot_lm` 绘制后验预测的线性模型**  \n",
        "\n",
        "**代码详解**  \n",
        "\n",
        "- 与上一段代码最大的不同之处在于，此时需要将`y_model` 存入`trace`中  \n",
        "\n",
        "- 在`az.plot_lm`中:  \n",
        "    - `y` 为真实数据中的因变量`df.scontrol`  \n",
        "    - `x` 为真实数据中的自变量`df.stress`  \n",
        "    - `y_model` 为结合后验采样生成的预测值  \n",
        "    （在图中表示为黄色和灰色的回归线）  \n",
        "\n",
        "> 😎*跑起来快很多*"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {
        "collapsed": false,
        "id": "60A783BCB541474994BA00433D87A1D8",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/60A783BCB541474994BA00433D87A1D8/s3qz9gof4z.png\">"
            ],
            "text/plain": [
              "<Figure size 1500x1000 with 1 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "# 导入真实的自变量\n",
        "x_value = xr.DataArray(df.stress)\n",
        "\n",
        "# 20000对参数与自变量进行组合，生成了20000条回归线\n",
        "trace.posterior[\"y_model\"] = trace.posterior[\"beta_0\"] + trace.posterior[\"beta_1\"] * x_value\n",
        "\n",
        "#绘制实际数据分布，与回归线结果\n",
        "az.plot_lm(\n",
        "           y= df.scontrol,\n",
        "           x= df.stress,\n",
        "           y_model = trace.posterior[\"y_model\"],\n",
        "           figsize=(15,10),\n",
        "           textsize=15,\n",
        "           grid=False)\n",
        "\n",
        "# 设置坐标轴标题、字体大小\n",
        "plt.xlabel('Stress', fontsize=16)  \n",
        "plt.ylabel('Self control', fontsize=16)  \n",
        "plt.xticks(fontsize=14)  \n",
        "plt.yticks(fontsize=14)  \n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "B4EFA95D0DEF443580FB3E0145516652",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 对特定结果的预测  \n",
        "\n",
        "> 回归模型的参数除了可以帮助我们理解自变量与因变量的关系，还可以帮助我们对特定结果做出出现预测  \n",
        "\n",
        "❓预测问题如：在数据集中，若压力水平为35，则对应的自我控制分数可能是多少  \n",
        "\n",
        "* 若我们以参数的后验均值($\\beta_0 = 64.33$, $\\beta_1=-0.59$ )进行预测  \n",
        "\n",
        "$$  \n",
        "64.33+ 35 * -0.59 =  43.68  \n",
        "$$  \n",
        "\n",
        "* 但在lec8中我们知道后验预测中存在 采样变异和参数变异  \n",
        "\n",
        "    * 在这个例子中，采样变异指的是压力水平为35的被试并不总是有着同样的自我控制水平  \n",
        "    \n",
        "    * 而参数变异指的是，后验分布并没有指定唯一的参数  \n",
        "\n",
        "* 在lec8中，我们知道，可以通过遍历所有参数组合下，所有事件发生可能性的求和平均来生成后验预测分布  \n",
        "$$  \n",
        "f\\left(y_{\\text{new}} | \\vec{y}\\right) = \\int\\int\\int f\\left(y_{new} | \\beta_0,\\beta_1,\\sigma\\right) f(\\beta_0,\\beta_1,\\sigma|\\vec{y}) d\\beta_0 d\\beta_1 d\\sigma .  \n",
        "$$  \n",
        "\n",
        "😥但这也太抽象了...  \n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "7AA547C87E97443E9A0FE7EE578BF390",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 通过MCMC采样值理解后验预测分布  \n",
        "\n",
        "\n",
        "* 通过MCMC采样，三个参数各获得了20000个采样值$\\left(\\beta_0^{(i)},\\beta_1^{(i)},\\sigma^{(i)}\\right)$  \n",
        "\n",
        "* 当X = 35时，每一组参数值都可以指定一个预测值$Y$可能符合的正态分布，我们可以从该正态分布中抽取一个预测值$Y_{new}$  \n",
        "\n",
        ">    以i = 1 和 i = 2 的情况为例  \n",
        "\n",
        "$$  \n",
        "Y_{\\text{new}}^{(i)} | \\; \\sim \\; N\\left(\\mu^{(i)}, \\left(\\sigma^{(i)}\\right)^2\\right) \\;\\; \\text{ with } \\;\\; \\mu^{(i)} = \\beta_0^{(i)} + \\beta_1^{(i)} \\cdot 35.  \n",
        "$$  \n",
        "\n",
        "\n",
        "![Image Name](https://cdn.kesci.com/upload/s3phhikeux.png?imageView2/0/w/960/h/960)  \n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "49AE46F479E54F5B907F91044951C16F",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**使用代码模拟单次后验预测**  \n",
        "\n",
        "* 我们有20000组参数值，就能得到20000个预测值$Y$可能符合的正态分布，并抽取出20000个预测值$Y_{new}$  \n",
        "\n",
        "* 这20000个预测值$Y_{new}$就构成了X = 35时，$Y$的后验预测分布  \n",
        "\n",
        "$$  \n",
        "\\left[  \n",
        "\\begin{array}{lll}  \n",
        "\\beta_0^{(1)} & \\beta_1^{(1)} & \\sigma^{(1)} \\\\  \n",
        "\\beta_0^{(2)} & \\beta_1^{(2)} & \\sigma^{(2)} \\\\  \n",
        "\\vdots & \\vdots & \\vdots \\\\  \n",
        "\\beta_0^{(20000)} & \\beta_1^{(20000)} & \\sigma^{(20000)} \\\\  \n",
        "\\end{array}  \n",
        "\\right]  \n",
        "\\;\\; \\longrightarrow \\;\\;  \n",
        "\\left[  \n",
        "\\begin{array}{l}  \n",
        "Y_{\\text{new}}^{(1)} \\\\  \n",
        "Y_{\\text{new}}^{(2)} \\\\  \n",
        "\\vdots \\\\  \n",
        "Y_{\\text{new}}^{(20000)} \\\\  \n",
        "\\end{array}  \n",
        "\\right]  \n",
        "$$  \n",
        "\n",
        "* 我们先用代码来模拟单次完整的抽取过程"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "collapsed": false,
        "id": "1E8414C09B5240E9AD651801A3742B30",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": true,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>beta_0</th>\n",
              "      <th>beta_1</th>\n",
              "      <th>sigma</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>58.866951</td>\n",
              "      <td>-0.478153</td>\n",
              "      <td>5.694923</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>58.573452</td>\n",
              "      <td>-0.479603</td>\n",
              "      <td>5.505718</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>57.449992</td>\n",
              "      <td>-0.473291</td>\n",
              "      <td>5.278344</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>58.356041</td>\n",
              "      <td>-0.453055</td>\n",
              "      <td>5.206056</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>58.281699</td>\n",
              "      <td>-0.458185</td>\n",
              "      <td>5.218929</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19995</th>\n",
              "      <td>58.333682</td>\n",
              "      <td>-0.458488</td>\n",
              "      <td>5.088218</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19996</th>\n",
              "      <td>62.974010</td>\n",
              "      <td>-0.596638</td>\n",
              "      <td>5.915683</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19997</th>\n",
              "      <td>64.748543</td>\n",
              "      <td>-0.637929</td>\n",
              "      <td>5.174244</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19998</th>\n",
              "      <td>63.677032</td>\n",
              "      <td>-0.606011</td>\n",
              "      <td>5.181334</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19999</th>\n",
              "      <td>61.971861</td>\n",
              "      <td>-0.561543</td>\n",
              "      <td>5.279800</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>20000 rows × 3 columns</p>\n",
              "</div>"
            ],
            "text/plain": [
              "          beta_0    beta_1     sigma\n",
              "0      58.866951 -0.478153  5.694923\n",
              "1      58.573452 -0.479603  5.505718\n",
              "2      57.449992 -0.473291  5.278344\n",
              "3      58.356041 -0.453055  5.206056\n",
              "4      58.281699 -0.458185  5.218929\n",
              "...          ...       ...       ...\n",
              "19995  58.333682 -0.458488  5.088218\n",
              "19996  62.974010 -0.596638  5.915683\n",
              "19997  64.748543 -0.637929  5.174244\n",
              "19998  63.677032 -0.606011  5.181334\n",
              "19999  61.971861 -0.561543  5.279800\n",
              "\n",
              "[20000 rows x 3 columns]"
            ]
          },
          "execution_count": 18,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# 采样得到的参数后验分布都储存在 trace.posterior中，我们进行一些提取操作\n",
        "pos_sample = trace.posterior.stack(sample=(\"chain\", \"draw\"))\n",
        "\n",
        "# 将每个参数的20000次采样结果存储在数据框中\n",
        "df_pos_sample = pd.DataFrame({\"beta_0\": pos_sample[\"beta_0\"].values,\n",
        "                              \"beta_1\": pos_sample[\"beta_1\"].values,\n",
        "                              \"sigma\": pos_sample[\"sigma\"].values})\n",
        "\n",
        "# 查看参数\n",
        "df_pos_sample"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {
        "collapsed": false,
        "id": "D13F27DD37154D7BB941EF38A2BA9E30",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": true,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "mu_i: 42.13, 预测值：32.71\n"
          ]
        }
      ],
      "source": [
        "# 抽取第一组参数组合，生成正态分布的均值\n",
        "row_i = 0  # 抽取第一行\n",
        "X_i = 35   # 假设压力分数为 35\n",
        "mu_i = df_pos_sample.beta_0[row_i] + df_pos_sample.beta_1[row_i] * X_i           \n",
        "sigma_i = df_pos_sample.sigma[row_i]\n",
        "\n",
        "# 从正态分布中随机抽取一个值，作为预测值\n",
        "prediction_i = np.random.normal(\n",
        "                                loc = mu_i,                                            \n",
        "                                scale= sigma_i, \n",
        "                                size=1)\n",
        "\n",
        "# 你可以运行该代码块多次，比较在相同参数下，预测值的变化(感受采样变异)。\n",
        "print(f\"mu_i: {mu_i:.2f}, 预测值：{prediction_i[0]:.2f}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "084EA08F8EE74C44A70852A9968BFE94",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**使用代码模拟多次后验预测**  \n",
        "\n",
        "* 通过上述四行代码，我们已经进行了一次完整的后验预测  \n",
        "\n",
        "* 我们可以写一个循环，重复这个过程20000次  \n",
        "\n",
        "* 最后的结果中，每一行代表一个参数对；mu 为预测的均值，y_new 为实际生成的预测值。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {
        "collapsed": false,
        "id": "D35DEDFC5421436290B022463FB5BE9C",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [],
      "source": [
        "# 生成两个空列，用来储存每一次生成的均值mu，和每一次抽取的预测值y_new\n",
        "df_pos_sample['mu'] = np.nan\n",
        "df_pos_sample['y_new'] = np.nan\n",
        "np.random.seed(84735)\n",
        "# 将之前的操作重复20000次\n",
        "for row_i in range(len(df_pos_sample)):\n",
        "    mu_i = df_pos_sample.beta_0[row_i] + df_pos_sample.beta_1[row_i] * 35\n",
        "    df_pos_sample[\"mu\"][row_i] = mu_i\n",
        "    df_pos_sample[\"y_new\"][row_i] = np.random.normal(loc = mu_i,\n",
        "                                            scale= df_pos_sample.sigma[row_i],\n",
        "                                            size=1)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {
        "collapsed": false,
        "id": "F3E8BCFA5AD14AD39F1378CFE22BD89A",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>beta_0</th>\n",
              "      <th>beta_1</th>\n",
              "      <th>sigma</th>\n",
              "      <th>mu</th>\n",
              "      <th>y_new</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>58.866951</td>\n",
              "      <td>-0.478153</td>\n",
              "      <td>5.694923</td>\n",
              "      <td>42.131607</td>\n",
              "      <td>45.086003</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>58.573452</td>\n",
              "      <td>-0.479603</td>\n",
              "      <td>5.505718</td>\n",
              "      <td>41.787347</td>\n",
              "      <td>40.036792</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>57.449992</td>\n",
              "      <td>-0.473291</td>\n",
              "      <td>5.278344</td>\n",
              "      <td>40.884811</td>\n",
              "      <td>45.719223</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>58.356041</td>\n",
              "      <td>-0.453055</td>\n",
              "      <td>5.206056</td>\n",
              "      <td>42.499108</td>\n",
              "      <td>46.599712</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>58.281699</td>\n",
              "      <td>-0.458185</td>\n",
              "      <td>5.218929</td>\n",
              "      <td>42.245208</td>\n",
              "      <td>40.469458</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19995</th>\n",
              "      <td>58.333682</td>\n",
              "      <td>-0.458488</td>\n",
              "      <td>5.088218</td>\n",
              "      <td>42.286588</td>\n",
              "      <td>47.062461</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19996</th>\n",
              "      <td>62.974010</td>\n",
              "      <td>-0.596638</td>\n",
              "      <td>5.915683</td>\n",
              "      <td>42.091697</td>\n",
              "      <td>48.615803</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19997</th>\n",
              "      <td>64.748543</td>\n",
              "      <td>-0.637929</td>\n",
              "      <td>5.174244</td>\n",
              "      <td>42.421028</td>\n",
              "      <td>40.989204</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19998</th>\n",
              "      <td>63.677032</td>\n",
              "      <td>-0.606011</td>\n",
              "      <td>5.181334</td>\n",
              "      <td>42.466645</td>\n",
              "      <td>42.623520</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19999</th>\n",
              "      <td>61.971861</td>\n",
              "      <td>-0.561543</td>\n",
              "      <td>5.279800</td>\n",
              "      <td>42.317854</td>\n",
              "      <td>43.806533</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>20000 rows × 5 columns</p>\n",
              "</div>"
            ],
            "text/plain": [
              "          beta_0    beta_1     sigma         mu      y_new\n",
              "0      58.866951 -0.478153  5.694923  42.131607  45.086003\n",
              "1      58.573452 -0.479603  5.505718  41.787347  40.036792\n",
              "2      57.449992 -0.473291  5.278344  40.884811  45.719223\n",
              "3      58.356041 -0.453055  5.206056  42.499108  46.599712\n",
              "4      58.281699 -0.458185  5.218929  42.245208  40.469458\n",
              "...          ...       ...       ...        ...        ...\n",
              "19995  58.333682 -0.458488  5.088218  42.286588  47.062461\n",
              "19996  62.974010 -0.596638  5.915683  42.091697  48.615803\n",
              "19997  64.748543 -0.637929  5.174244  42.421028  40.989204\n",
              "19998  63.677032 -0.606011  5.181334  42.466645  42.623520\n",
              "19999  61.971861 -0.561543  5.279800  42.317854  43.806533\n",
              "\n",
              "[20000 rows x 5 columns]"
            ]
          },
          "execution_count": 21,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "df_pos_sample"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "D4D71E0ECE11479C835294341F927DD6",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "**绘制后验预测分布**  \n",
        "\n",
        "根据刚刚生成的数据，我们可以分别绘制出 $\\mu$ 与 $Y_{new}$ 的后验预测分布图"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {
        "collapsed": false,
        "id": "3A00CFB23F6E40AAA13798276D05572D",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": true,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "x=35时y的取值有: [[35 46]\n",
            " [35 46]\n",
            " [35 37]\n",
            " [35 45]\n",
            " [35 33]\n",
            " [35 43]\n",
            " [35 38]\n",
            " [35 35]\n",
            " [35 38]\n",
            " [35 47]]\n"
          ]
        }
      ],
      "source": [
        "#查看真实数据中的取值，与后验预测分布作对比\n",
        "print(\"x=35时y的取值有:\", np.array(df[df[\"stress\"]==35]))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {
        "collapsed": false,
        "id": "9A2E07F9B2E441CCAE2253E758F6D615",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/9A2E07F9B2E441CCAE2253E758F6D615/s3qz9lg48e.png\">"
            ],
            "text/plain": [
              "<Figure size 1500x500 with 2 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "#新建画布\n",
        "fig, axs = plt.subplots(1, 2, figsize=(15, 5), sharey=True, sharex=True)        \n",
        "\n",
        "#在第一个画布中绘制出生成的mu的分布\n",
        "sns.kdeplot(data=df_pos_sample,                                                \n",
        "            x=\"mu\", \n",
        "            color=\"black\",\n",
        "            ax=axs[0])\n",
        "\n",
        "#在第二个画布中绘制出生成的y_new的分布\n",
        "sns.kdeplot(data=df_pos_sample,                                                 \n",
        "            x=\"y_new\", \n",
        "            color=\"black\",\n",
        "            ax=axs[1])\n",
        "\n",
        "fig.suptitle('Posterior predictive distribution(X=35)', fontsize=16)\n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "018BE96E04BC40E48847E7E921B9D3A1",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "从上图可以看到， $Y_{new}$ 分布的不确定性远大于 $\\mu$ 分布的不确定性  \n",
        "\n",
        "同样可以画出二者95%的可信区间  \n",
        "\n",
        "\n",
        "\n",
        "![Image Name](https://cdn.kesci.com/upload/s3pi09kuxm.png?imageView2/0/w/960/h/960)  \n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2C2E4F17548044CEB056F98A5346DFF2",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 总体后验预测分布  \n",
        "\n",
        "* 除了生成特定自变量下，因变量的分布，也可以生成总体因变量的后验预测分布  \n",
        "\n",
        "* 通过 `pymc.sample_posterior_predictive`方法可以快速从模型生成后验预测数据。  \n",
        "* 可以看到 ppc_data 中多了一项 posterior_predictive"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {
        "collapsed": false,
        "id": "92D323AAC5964C19A923B309D06DC64B",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Sampling: [y_est]\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "\n",
              "<style>\n",
              "    /* Turns off some styling */\n",
              "    progress {\n",
              "        /* gets rid of default border in Firefox and Opera. */\n",
              "        border: none;\n",
              "        /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
              "        background-size: auto;\n",
              "    }\n",
              "    progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
              "        background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
              "    }\n",
              "    .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
              "        background: #F44336;\n",
              "    }\n",
              "</style>\n"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "\n",
              "            <div>\n",
              "              <div class='xr-header'>\n",
              "                <div class=\"xr-obj-type\">arviz.InferenceData</div>\n",
              "              </div>\n",
              "              <ul class=\"xr-sections group-sections\">\n",
              "              \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_posterior_predictive4afa5e19-d1e1-4717-8fed-2562df7f7009\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_posterior_predictive4afa5e19-d1e1-4717-8fed-2562df7f7009\" class = \"xr-section-summary\">posterior_predictive</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:      (chain: 4, draw: 5000, y_est_dim_2: 174)\n",
              "Coordinates:\n",
              "  * chain        (chain) int64 0 1 2 3\n",
              "  * draw         (draw) int64 0 1 2 3 4 5 6 ... 4994 4995 4996 4997 4998 4999\n",
              "  * y_est_dim_2  (y_est_dim_2) int64 0 1 2 3 4 5 6 ... 168 169 170 171 172 173\n",
              "Data variables:\n",
              "    y_est        (chain, draw, y_est_dim_2) float64 39.61 45.47 ... 36.46 40.77\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:49:01.501217\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-56b785bb-5e72-4bea-8d5a-a98165149039' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-56b785bb-5e72-4bea-8d5a-a98165149039' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>chain</span>: 4</li><li><span class='xr-has-index'>draw</span>: 5000</li><li><span class='xr-has-index'>y_est_dim_2</span>: 174</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-7cf68d25-8440-41bf-b719-23fb95308227' class='xr-section-summary-in' type='checkbox'  checked><label for='section-7cf68d25-8440-41bf-b719-23fb95308227' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>chain</span></div><div class='xr-var-dims'>(chain)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-43202d0a-4d10-4938-9356-2935b380aee5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-43202d0a-4d10-4938-9356-2935b380aee5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5a7ae6da-6fb7-4187-85df-89301cc978d6' class='xr-var-data-in' type='checkbox'><label for='data-5a7ae6da-6fb7-4187-85df-89301cc978d6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>draw</span></div><div class='xr-var-dims'>(draw)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 ... 4996 4997 4998 4999</div><input id='attrs-13caf0fa-67ba-43e5-897a-0a85d2720a35' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-13caf0fa-67ba-43e5-897a-0a85d2720a35' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d19a5481-a870-46f9-900c-fe11c440234b' class='xr-var-data-in' type='checkbox'><label for='data-d19a5481-a870-46f9-900c-fe11c440234b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([   0,    1,    2, ..., 4997, 4998, 4999])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>y_est_dim_2</span></div><div class='xr-var-dims'>(y_est_dim_2)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 ... 169 170 171 172 173</div><input id='attrs-15022951-c684-4143-baa8-0ea729fed1b2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-15022951-c684-4143-baa8-0ea729fed1b2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b097d910-8fc1-42bb-9801-8ea6565a6f05' class='xr-var-data-in' type='checkbox'><label for='data-b097d910-8fc1-42bb-9801-8ea6565a6f05' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,\n",
              "        14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,\n",
              "        28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,\n",
              "        42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,\n",
              "        56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,\n",
              "        70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,\n",
              "        84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,\n",
              "        98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\n",
              "       112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,\n",
              "       126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n",
              "       140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n",
              "       154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,\n",
              "       168, 169, 170, 171, 172, 173])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-7471d3d9-e13c-45c3-9ab0-9f01ebfdc916' class='xr-section-summary-in' type='checkbox'  checked><label for='section-7471d3d9-e13c-45c3-9ab0-9f01ebfdc916' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>y_est</span></div><div class='xr-var-dims'>(chain, draw, y_est_dim_2)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>39.61 45.47 44.14 ... 36.46 40.77</div><input id='attrs-be47ac5f-bf9f-4dcf-a3a2-6eafa44893dd' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-be47ac5f-bf9f-4dcf-a3a2-6eafa44893dd' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-37e9bc39-9bf7-4ff9-b855-1fa97a526ae0' class='xr-var-data-in' type='checkbox'><label for='data-37e9bc39-9bf7-4ff9-b855-1fa97a526ae0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[[39.61281392, 45.46873138, 44.14385634, ..., 27.92191519,\n",
              "         43.32320793, 40.13491772],\n",
              "        [35.59116949, 39.12292507, 39.62340179, ..., 41.32085249,\n",
              "         34.30261981, 39.71610657],\n",
              "        [28.39796985, 41.04071002, 34.52400344, ..., 42.35071349,\n",
              "         40.54206798, 48.21903222],\n",
              "        ...,\n",
              "        [35.43264842, 30.0358341 , 41.84833457, ..., 43.24578341,\n",
              "         36.91133523, 41.64433868],\n",
              "        [34.04112748, 47.65054186, 44.84811028, ..., 48.59941427,\n",
              "         43.45865938, 50.52985143],\n",
              "        [39.78589073, 38.17004407, 33.14006333, ..., 39.84096091,\n",
              "         35.01442793, 52.58195361]],\n",
              "\n",
              "       [[40.76907765, 33.51772932, 47.41260581, ..., 36.97834638,\n",
              "         41.04695522, 43.37884595],\n",
              "        [32.1742748 , 37.62554696, 47.49881293, ..., 30.00112538,\n",
              "         40.12815391, 41.42052046],\n",
              "        [33.92935844, 33.06922105, 34.30020763, ..., 39.16413717,\n",
              "         45.80724229, 44.65825331],\n",
              "...\n",
              "        [33.83828437, 40.13339581, 42.81142947, ..., 47.46151795,\n",
              "         44.64105365, 43.82034744],\n",
              "        [43.16155993, 29.92011201, 46.49781469, ..., 39.83736684,\n",
              "         42.36817295, 39.46526526],\n",
              "        [40.52423808, 39.9135199 , 41.01815306, ..., 31.60950456,\n",
              "         36.92922219, 43.41841762]],\n",
              "\n",
              "       [[42.66159055, 38.45427085, 37.92970079, ..., 42.52164416,\n",
              "         36.50060754, 47.12391065],\n",
              "        [35.93830954, 44.39991027, 46.43904906, ..., 36.07683772,\n",
              "         38.63005149, 50.99572428],\n",
              "        [31.35404115, 40.76756404, 47.68086194, ..., 41.97372198,\n",
              "         39.80447458, 48.11706881],\n",
              "        ...,\n",
              "        [30.99757507, 40.16411231, 51.38385521, ..., 33.09927765,\n",
              "         35.18990164, 33.65986243],\n",
              "        [33.87155967, 40.20251663, 50.89425679, ..., 43.24332781,\n",
              "         32.47916458, 38.54516115],\n",
              "        [54.96573037, 36.27290071, 50.80660809, ..., 45.63983669,\n",
              "         36.45524588, 40.77402462]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-79b7611d-6f69-49fe-9b6c-59239efdc4c0' class='xr-section-summary-in' type='checkbox'  checked><label for='section-79b7611d-6f69-49fe-9b6c-59239efdc4c0' class='xr-section-summary' >Attributes: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:49:01.501217</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_observed_data3a2463bc-ba76-45c7-b8dd-04cc4413ca67\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_observed_data3a2463bc-ba76-45c7-b8dd-04cc4413ca67\" class = \"xr-section-summary\">observed_data</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:      (y_est_dim_0: 174)\n",
              "Coordinates:\n",
              "  * y_est_dim_0  (y_est_dim_0) int64 0 1 2 3 4 5 6 ... 168 169 170 171 172 173\n",
              "Data variables:\n",
              "    y_est        (y_est_dim_0) float64 47.0 40.0 40.0 46.0 ... 35.0 38.0 39.0\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:49:01.517646\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-acbbaf34-dc66-48f0-a752-fb618169494c' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-acbbaf34-dc66-48f0-a752-fb618169494c' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>y_est_dim_0</span>: 174</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-c5280b26-94a2-438f-a833-7d87b0b9da3c' class='xr-section-summary-in' type='checkbox'  checked><label for='section-c5280b26-94a2-438f-a833-7d87b0b9da3c' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>y_est_dim_0</span></div><div class='xr-var-dims'>(y_est_dim_0)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 ... 169 170 171 172 173</div><input id='attrs-9d7b4711-4064-496b-93eb-a46f3e63bfe7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-9d7b4711-4064-496b-93eb-a46f3e63bfe7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-951dc615-a19e-4130-b7f1-2a0f0eef614a' class='xr-var-data-in' type='checkbox'><label for='data-951dc615-a19e-4130-b7f1-2a0f0eef614a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,\n",
              "        14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,\n",
              "        28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,\n",
              "        42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,\n",
              "        56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,\n",
              "        70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,\n",
              "        84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,\n",
              "        98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\n",
              "       112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,\n",
              "       126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n",
              "       140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n",
              "       154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,\n",
              "       168, 169, 170, 171, 172, 173])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1b13f88f-87ad-4320-889d-b4949894b4c8' class='xr-section-summary-in' type='checkbox'  checked><label for='section-1b13f88f-87ad-4320-889d-b4949894b4c8' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>y_est</span></div><div class='xr-var-dims'>(y_est_dim_0)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>47.0 40.0 40.0 ... 35.0 38.0 39.0</div><input id='attrs-f9748c7d-7d76-4e83-b317-ca4a80f466af' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-f9748c7d-7d76-4e83-b317-ca4a80f466af' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-badcbed1-02d8-49ae-b6d4-0d19b00ff738' class='xr-var-data-in' type='checkbox'><label for='data-badcbed1-02d8-49ae-b6d4-0d19b00ff738' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([47., 40., 40., 46., 50., 43., 36., 35., 47., 50., 44., 34., 26.,\n",
              "       42., 48., 41., 46., 43., 40., 52., 46., 41., 46., 40., 42., 41.,\n",
              "       48., 49., 46., 35., 37., 45., 37., 36., 35., 45., 35., 40., 35.,\n",
              "       49., 39., 38., 45., 40., 37., 36., 42., 32., 40., 45., 33., 45.,\n",
              "       42., 40., 23., 32., 50., 44., 40., 36., 28., 51., 40., 33., 29.,\n",
              "       37., 38., 38., 26., 40., 41., 43., 44., 38., 34., 46., 43., 42.,\n",
              "       43., 40., 33., 44., 38., 40., 43., 31., 51., 50., 42., 41., 34.,\n",
              "       38., 37., 42., 41., 27., 46., 33., 35., 48., 39., 41., 43., 31.,\n",
              "       40., 38., 43., 38., 36., 41., 48., 44., 28., 36., 32., 42., 30.,\n",
              "       40., 43., 36., 38., 25., 41., 35., 36., 45., 35., 36., 33., 42.,\n",
              "       28., 43., 44., 38., 31., 33., 29., 43., 47., 42., 48., 27., 36.,\n",
              "       31., 48., 34., 40., 32., 46., 34., 39., 36., 37., 39., 47., 44.,\n",
              "       37., 40., 50., 35., 42., 24., 38., 41., 45., 35., 44., 46., 39.,\n",
              "       52., 33., 35., 38., 39.])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-0641a5e9-4684-4703-bbec-ae1d001feda3' class='xr-section-summary-in' type='checkbox'  checked><label for='section-0641a5e9-4684-4703-bbec-ae1d001feda3' class='xr-section-summary' >Attributes: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:49:01.517646</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "            <li class = \"xr-section-item\">\n",
              "                  <input id=\"idata_constant_data88f2d6a5-3828-4ec9-855d-51993003da64\" class=\"xr-section-summary-in\" type=\"checkbox\">\n",
              "                  <label for=\"idata_constant_data88f2d6a5-3828-4ec9-855d-51993003da64\" class = \"xr-section-summary\">constant_data</label>\n",
              "                  <div class=\"xr-section-inline-details\"></div>\n",
              "                  <div class=\"xr-section-details\">\n",
              "                      <ul id=\"xr-dataset-coord-list\" class=\"xr-var-list\">\n",
              "                          <div style=\"padding-left:2rem;\"><div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
              "<defs>\n",
              "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
              "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
              "</symbol>\n",
              "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
              "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
              "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
              "</symbol>\n",
              "</defs>\n",
              "</svg>\n",
              "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body[data-theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block !important;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt,\n",
              ".xr-attrs dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
              "Dimensions:  (x_dim_0: 174)\n",
              "Coordinates:\n",
              "  * x_dim_0  (x_dim_0) int64 0 1 2 3 4 5 6 7 ... 166 167 168 169 170 171 172 173\n",
              "Data variables:\n",
              "    x        (x_dim_0) int32 38 43 31 35 45 42 41 58 ... 29 36 43 32 42 42 39 33\n",
              "Attributes:\n",
              "    created_at:                 2023-11-07T09:49:01.522468\n",
              "    arviz_version:              0.16.0\n",
              "    inference_library:          pymc\n",
              "    inference_library_version:  5.6.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-7f88260e-4964-40f7-984a-9084a89cb50c' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-7f88260e-4964-40f7-984a-9084a89cb50c' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>x_dim_0</span>: 174</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-12ea8be8-991a-43e6-865c-225aefa90851' class='xr-section-summary-in' type='checkbox'  checked><label for='section-12ea8be8-991a-43e6-865c-225aefa90851' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>x_dim_0</span></div><div class='xr-var-dims'>(x_dim_0)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 ... 169 170 171 172 173</div><input id='attrs-5bbe979e-46b6-46cd-91ea-f5e921b87d4c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5bbe979e-46b6-46cd-91ea-f5e921b87d4c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-fc9e50ef-b358-4c63-966a-3fead87bdef8' class='xr-var-data-in' type='checkbox'><label for='data-fc9e50ef-b358-4c63-966a-3fead87bdef8' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,\n",
              "        14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,\n",
              "        28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,\n",
              "        42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,\n",
              "        56,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,\n",
              "        70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,\n",
              "        84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,\n",
              "        98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\n",
              "       112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,\n",
              "       126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,\n",
              "       140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n",
              "       154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,\n",
              "       168, 169, 170, 171, 172, 173])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-94d59003-c812-48b7-b793-9c1811556ad6' class='xr-section-summary-in' type='checkbox'  checked><label for='section-94d59003-c812-48b7-b793-9c1811556ad6' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>x</span></div><div class='xr-var-dims'>(x_dim_0)</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>38 43 31 35 45 ... 32 42 42 39 33</div><input id='attrs-a848dac5-15b0-4c85-8c03-94af180344b3' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-a848dac5-15b0-4c85-8c03-94af180344b3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5932fea3-4609-4310-948a-dacd95335267' class='xr-var-data-in' type='checkbox'><label for='data-5932fea3-4609-4310-948a-dacd95335267' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([38, 43, 31, 35, 45, 42, 41, 58, 47, 33, 40, 34, 45, 38, 31, 40, 37,\n",
              "       36, 37, 38, 35, 34, 44, 44, 36, 36, 39, 40, 30, 47, 35, 48, 42, 42,\n",
              "       40, 35, 36, 28, 47, 27, 49, 41, 37, 37, 41, 49, 54, 50, 36, 43, 35,\n",
              "       33, 40, 39, 39, 46, 26, 49, 36, 42, 43, 33, 46, 46, 51, 43, 38, 44,\n",
              "       49, 26, 31, 50, 47, 42, 46, 36, 40, 33, 33, 50, 43, 30, 36, 37, 30,\n",
              "       42, 39, 46, 39, 28, 52, 26, 43, 38, 38, 46, 39, 44, 41, 44, 42, 30,\n",
              "       39, 45, 46, 38, 36, 42, 39, 41, 37, 32, 49, 40, 42, 43, 48, 47, 35,\n",
              "       44, 35, 48, 38, 45, 34, 30, 35, 45, 42, 32, 39, 38, 33, 35, 36, 36,\n",
              "       46, 43, 26, 34, 37, 44, 41, 50, 22, 43, 41, 57, 43, 45, 39, 43, 41,\n",
              "       57, 35, 43, 39, 38, 33, 55, 38, 46, 42, 48, 26, 40, 29, 36, 43, 32,\n",
              "       42, 42, 39, 33], dtype=int32)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-86a7308d-5c51-4d09-b424-a366df29c9cb' class='xr-section-summary-in' type='checkbox'  checked><label for='section-86a7308d-5c51-4d09-b424-a366df29c9cb' class='xr-section-summary' >Attributes: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>created_at :</span></dt><dd>2023-11-07T09:49:01.522468</dd><dt><span>arviz_version :</span></dt><dd>0.16.0</dd><dt><span>inference_library :</span></dt><dd>pymc</dd><dt><span>inference_library_version :</span></dt><dd>5.6.0</dd></dl></div></li></ul></div></div><br></div>\n",
              "                      </ul>\n",
              "                  </div>\n",
              "            </li>\n",
              "            \n",
              "              </ul>\n",
              "            </div>\n",
              "            <style> /* CSS stylesheet for displaying InferenceData objects in jupyterlab.\n",
              " *\n",
              " */\n",
              "\n",
              ":root {\n",
              "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
              "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
              "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
              "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
              "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
              "  --xr-background-color: var(--jp-layout-color0, white);\n",
              "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
              "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
              "}\n",
              "\n",
              "html[theme=dark],\n",
              "body.vscode-dark {\n",
              "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
              "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
              "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
              "  --xr-border-color: #1F1F1F;\n",
              "  --xr-disabled-color: #515151;\n",
              "  --xr-background-color: #111111;\n",
              "  --xr-background-color-row-even: #111111;\n",
              "  --xr-background-color-row-odd: #313131;\n",
              "}\n",
              "\n",
              ".xr-wrap {\n",
              "  display: block;\n",
              "  min-width: 300px;\n",
              "  max-width: 700px;\n",
              "}\n",
              "\n",
              ".xr-text-repr-fallback {\n",
              "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-header {\n",
              "  padding-top: 6px;\n",
              "  padding-bottom: 6px;\n",
              "  margin-bottom: 4px;\n",
              "  border-bottom: solid 1px var(--xr-border-color);\n",
              "}\n",
              "\n",
              ".xr-header > div,\n",
              ".xr-header > ul {\n",
              "  display: inline;\n",
              "  margin-top: 0;\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-obj-type,\n",
              ".xr-array-name {\n",
              "  margin-left: 2px;\n",
              "  margin-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-obj-type {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-sections {\n",
              "  padding-left: 0 !important;\n",
              "  display: grid;\n",
              "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
              "}\n",
              "\n",
              ".xr-sections.group-sections {\n",
              "  grid-template-columns: auto;\n",
              "}\n",
              "\n",
              ".xr-section-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-section-item input {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-item input + label {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label {\n",
              "  cursor: pointer;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-item input:enabled + label:hover {\n",
              "  color: var(--xr-font-color0);\n",
              "}\n",
              "\n",
              ".xr-section-summary {\n",
              "  grid-column: 1;\n",
              "  color: var(--xr-font-color2);\n",
              "  font-weight: 500;\n",
              "}\n",
              "\n",
              ".xr-section-summary > span {\n",
              "  display: inline-block;\n",
              "  padding-left: 0.5em;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label {\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in + label:before {\n",
              "  display: inline-block;\n",
              "  content: '►';\n",
              "  font-size: 11px;\n",
              "  width: 15px;\n",
              "  text-align: center;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:disabled + label:before {\n",
              "  color: var(--xr-disabled-color);\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label:before {\n",
              "  content: '▼';\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked + label > span {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-section-summary,\n",
              ".xr-section-inline-details {\n",
              "  padding-top: 4px;\n",
              "  padding-bottom: 4px;\n",
              "}\n",
              "\n",
              ".xr-section-inline-details {\n",
              "  grid-column: 2 / -1;\n",
              "}\n",
              "\n",
              ".xr-section-details {\n",
              "  display: none;\n",
              "  grid-column: 1 / -1;\n",
              "  margin-bottom: 5px;\n",
              "}\n",
              "\n",
              ".xr-section-summary-in:checked ~ .xr-section-details {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-array-wrap {\n",
              "  grid-column: 1 / -1;\n",
              "  display: grid;\n",
              "  grid-template-columns: 20px auto;\n",
              "}\n",
              "\n",
              ".xr-array-wrap > label {\n",
              "  grid-column: 1;\n",
              "  vertical-align: top;\n",
              "}\n",
              "\n",
              ".xr-preview {\n",
              "  color: var(--xr-font-color3);\n",
              "}\n",
              "\n",
              ".xr-array-preview,\n",
              ".xr-array-data {\n",
              "  padding: 0 5px !important;\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-array-data,\n",
              ".xr-array-in:checked ~ .xr-array-preview {\n",
              "  display: none;\n",
              "}\n",
              "\n",
              ".xr-array-in:checked ~ .xr-array-data,\n",
              ".xr-array-preview {\n",
              "  display: inline-block;\n",
              "}\n",
              "\n",
              ".xr-dim-list {\n",
              "  display: inline-block !important;\n",
              "  list-style: none;\n",
              "  padding: 0 !important;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list li {\n",
              "  display: inline-block;\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "}\n",
              "\n",
              ".xr-dim-list:before {\n",
              "  content: '(';\n",
              "}\n",
              "\n",
              ".xr-dim-list:after {\n",
              "  content: ')';\n",
              "}\n",
              "\n",
              ".xr-dim-list li:not(:last-child):after {\n",
              "  content: ',';\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-has-index {\n",
              "  font-weight: bold;\n",
              "}\n",
              "\n",
              ".xr-var-list,\n",
              ".xr-var-item {\n",
              "  display: contents;\n",
              "}\n",
              "\n",
              ".xr-var-item > div,\n",
              ".xr-var-item label,\n",
              ".xr-var-item > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-even);\n",
              "  margin-bottom: 0;\n",
              "}\n",
              "\n",
              ".xr-var-item > .xr-var-name:hover span {\n",
              "  padding-right: 5px;\n",
              "}\n",
              "\n",
              ".xr-var-list > li:nth-child(odd) > div,\n",
              ".xr-var-list > li:nth-child(odd) > label,\n",
              ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
              "  background-color: var(--xr-background-color-row-odd);\n",
              "}\n",
              "\n",
              ".xr-var-name {\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-var-dims {\n",
              "  grid-column: 2;\n",
              "}\n",
              "\n",
              ".xr-var-dtype {\n",
              "  grid-column: 3;\n",
              "  text-align: right;\n",
              "  color: var(--xr-font-color2);\n",
              "}\n",
              "\n",
              ".xr-var-preview {\n",
              "  grid-column: 4;\n",
              "}\n",
              "\n",
              ".xr-var-name,\n",
              ".xr-var-dims,\n",
              ".xr-var-dtype,\n",
              ".xr-preview,\n",
              ".xr-attrs dt {\n",
              "  white-space: nowrap;\n",
              "  overflow: hidden;\n",
              "  text-overflow: ellipsis;\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-var-name:hover,\n",
              ".xr-var-dims:hover,\n",
              ".xr-var-dtype:hover,\n",
              ".xr-attrs dt:hover {\n",
              "  overflow: visible;\n",
              "  width: auto;\n",
              "  z-index: 1;\n",
              "}\n",
              "\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  display: none;\n",
              "  background-color: var(--xr-background-color) !important;\n",
              "  padding-bottom: 5px !important;\n",
              "}\n",
              "\n",
              ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
              ".xr-var-data-in:checked ~ .xr-var-data {\n",
              "  display: block;\n",
              "}\n",
              "\n",
              ".xr-var-data > table {\n",
              "  float: right;\n",
              "}\n",
              "\n",
              ".xr-var-name span,\n",
              ".xr-var-data,\n",
              ".xr-attrs {\n",
              "  padding-left: 25px !important;\n",
              "}\n",
              "\n",
              ".xr-attrs,\n",
              ".xr-var-attrs,\n",
              ".xr-var-data {\n",
              "  grid-column: 1 / -1;\n",
              "}\n",
              "\n",
              "dl.xr-attrs {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  display: grid;\n",
              "  grid-template-columns: 125px auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt, dd {\n",
              "  padding: 0;\n",
              "  margin: 0;\n",
              "  float: left;\n",
              "  padding-right: 10px;\n",
              "  width: auto;\n",
              "}\n",
              "\n",
              ".xr-attrs dt {\n",
              "  font-weight: normal;\n",
              "  grid-column: 1;\n",
              "}\n",
              "\n",
              ".xr-attrs dt:hover span {\n",
              "  display: inline-block;\n",
              "  background: var(--xr-background-color);\n",
              "  padding-right: 10px;\n",
              "}\n",
              "\n",
              ".xr-attrs dd {\n",
              "  grid-column: 2;\n",
              "  white-space: pre-wrap;\n",
              "  word-break: break-all;\n",
              "}\n",
              "\n",
              ".xr-icon-database,\n",
              ".xr-icon-file-text2 {\n",
              "  display: inline-block;\n",
              "  vertical-align: middle;\n",
              "  width: 1em;\n",
              "  height: 1.5em !important;\n",
              "  stroke-width: 0;\n",
              "  stroke: currentColor;\n",
              "  fill: currentColor;\n",
              "}\n",
              ".xr-wrap{width:700px!important;} </style>"
            ],
            "text/plain": [
              "Inference data with groups:\n",
              "\t> posterior_predictive\n",
              "\t> observed_data\n",
              "\t> constant_data"
            ]
          },
          "execution_count": 24,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "with linear_model:\n",
        "    ppc_data = pm.sample_posterior_predictive(trace)\n",
        "\n",
        "ppc_data"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "91C4FFB3C8EA4C56BC7E62A6559668A5",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "接着，我们可以使用 arviz 提供的后验预测检查函数 `plot_ppc`来绘制结果。  \n",
        "\n",
        "- 黑色线条代表观测值(自我控制分数)总体的分布情况。  \n",
        "\n",
        "- 蓝色线代表每一对采样参数对应的后验预测的分布情况。  \n",
        "\n",
        "- 橙色为后验预测的均值的分布情况"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {
        "collapsed": false,
        "id": "29C70CE7D0844B6E8E003FCB822504D8",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "<Axes: xlabel='y_est / y_est'>"
            ]
          },
          "execution_count": 25,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/29C70CE7D0844B6E8E003FCB822504D8/s3qz9zsjwq.png\">"
            ],
            "text/plain": [
              "<Figure size 640x480 with 1 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "az.plot_ppc(ppc_data, num_pp_samples=1000) # num_pp_samples 参数代表从总的采样(20000)选取多少采样(这里是1000)进行后验预测计算"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "4060F4C36EA44DFBB41C2DA0760E1436",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 对新数据的预测  \n",
        "\n",
        "- 采样得到的后验参数基于\"Tsinghua\"的数据，到目前为止，我们都在使用后验参数对这一批数据做出后验预测  \n",
        "\n",
        "- Human Penguin Project 是一个跨国研究，那么基于\"Tsinghua\"数据得出的后验参数估计对其他数据的预测效果如何？  \n",
        "\n",
        "- 我们可以选用一批新的数据，查看当前参数是否能预测新数据(例如 \"Oxford\")中的变量关系"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {
        "collapsed": false,
        "id": "6B078761BAC943B5A8258EAD4365DBAF",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>stress</th>\n",
              "      <th>scontrol</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>index</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>19</td>\n",
              "      <td>46</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>31</td>\n",
              "      <td>40</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>33</td>\n",
              "      <td>40</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>41</td>\n",
              "      <td>33</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>39</td>\n",
              "      <td>33</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "       stress  scontrol\n",
              "index                  \n",
              "0          19        46\n",
              "1          31        40\n",
              "2          33        40\n",
              "3          41        33\n",
              "4          39        33"
            ]
          },
          "execution_count": 26,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# 筛选站点为\"Oxford\"的数据\n",
        "df_new = df_raw[df_raw[\"Site\"] == \"Oxford\"]\n",
        "\n",
        "# 选择需要的两列\n",
        "df_new = df_new[[\"stress\",\"scontrol\"]]\n",
        "\n",
        "#设置索引\n",
        "df_new[\"index\"] = range(len(df_new))\n",
        "df_new = df_new.set_index(\"index\")\n",
        "\n",
        "# 显示部分数据\n",
        "df_new.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {
        "collapsed": false,
        "id": "E70E31C296AF4C268DC0EFB986726326",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/E70E31C296AF4C268DC0EFB986726326/s3qza3swx2.png\">"
            ],
            "text/plain": [
              "<Figure size 1500x1000 with 1 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "# 除替换自变量数据外，代码思路与 *对变量关系的预测* 部分完全一致。\n",
        "# 导入新的自变量\n",
        "x_new = xr.DataArray(df_new.stress)\n",
        "\n",
        "# 20000对参数与自变量进行组合，生成了20000条回归线\n",
        "y_model_new = trace.posterior[\"beta_0\"] + trace.posterior[\"beta_1\"] * x_new\n",
        "\n",
        "#绘制实际数据分布，与回归线结果\n",
        "az.plot_lm(\n",
        "           y= df_new.scontrol,\n",
        "           x= df_new.stress,\n",
        "           y_model = y_model_new,\n",
        "           figsize=(15,10),\n",
        "           textsize=15,\n",
        "           grid=False)\n",
        "\n",
        "# 设置坐标轴标题、字体大小\n",
        "plt.title(\"posterior predictive check for a new dataset\", fontsize=20)\n",
        "plt.xlabel('Stress', fontsize=16)  \n",
        "plt.ylabel('Self control', fontsize=16)  \n",
        "plt.xticks(fontsize=14)  \n",
        "plt.yticks(fontsize=14)  \n",
        "sns.despine()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "E9F4903C6DDA417A99DA49240C1F5BD0",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "### 思考题：  \n",
        "- 如何对预测的效果进行检查？"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3FA778E26ECE4047878DD0E63A1F2F5F",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 使用bambi进行模型定义  \n",
        "\n",
        "Bambi 是一个用于贝叶斯统计建模的 Python 包，建立在 PyMC 上。  \n",
        "\n",
        "```pyhon  \n",
        "model = bmb.Model('scontrol ~ stress',  \n",
        "                  data=df,  \n",
        "                  dropna=True)  \n",
        "```\n",
        "\n",
        "* 它提供了一个更加简化的界面，使得使用贝叶斯统计模型更加容易，特别是在处理线性和广义线性混合模型时。  \n",
        "\n",
        "* 上面的代码提供了一个示例，我们可以简单的三行代码来完成之前的回归模型的定义。  \n",
        "\n",
        "* 其中，我们可以通过 lme4 的形式来表达线性关系：`'scontrol ~ stress'`。~左边是因变量，右边是自变量。例如还有其他变量(如addiction)可以扩展写为`''scontrol ~ stress' + addiction'`。  \n",
        " \n",
        "* 需要注意的是，在bambi中，如果我们不对先验进行定义，它会自动选择一个比较弱(weakly informative)的先验。"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2030F3838DD147C8BCCB57491CC313D1",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": []
      },
      "source": [
        "我们通过代码示例来说明如何通过 bambi 复现之前的分析：  \n",
        "\n",
        "1. 首先定义模型"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 28,
      "metadata": {
        "collapsed": false,
        "id": "F7EA7E00703845FFA5042536F40B0175",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "       Formula: scontrol ~ stress\n",
              "        Family: gaussian\n",
              "          Link: mu = identity\n",
              "  Observations: 174\n",
              "        Priors: \n",
              "    target = mu\n",
              "        Common-level effects\n",
              "            Intercept ~ Normal(mu: 70.0, sigma: 4.0)\n",
              "            stress ~ Normal(mu: 0.0, sigma: 0.8)\n",
              "        \n",
              "        Auxiliary parameters\n",
              "            sigma ~ Exponential(lam: 0.6)"
            ]
          },
          "execution_count": 28,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "import bambi as bmb\n",
        "\n",
        "#定义先验并传入模型中\n",
        "intercept_prior = bmb.Prior(\"Normal\", mu=70, sigma=4)     #对应beta_0\n",
        "stress_prior = bmb.Prior(\"Normal\", mu=0, sigma=0.8)          #对应beta_1\n",
        "sigma_prior = bmb.Prior(\"Exponential\", lam = 0.6)            #对应sigma\n",
        "\n",
        "# 将三个参数的先验定义在字典prior中\n",
        "priors = {\"Intercept\": intercept_prior, \n",
        "          \"stress\": stress_prior,\n",
        "          \"sigma\": sigma_prior}\n",
        "\n",
        "#定义关系式，传入数据\n",
        "model = bmb.Model('scontrol ~ stress', \n",
        "                  data=df,\n",
        "                  priors=priors,\n",
        "                  dropna=True)\n",
        "#总结对模型的设置\n",
        "model"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "630E11DAC4644F3699C240C26C1CA40A",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "2. 拟合模型，使用MCMC方法采样得到后验的近似分布  \n",
        "\n",
        "- 提示：`model.fit` 基于 `pm.sample` 方法。因此，他们的参数设置是相同可继承的。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 29,
      "metadata": {
        "collapsed": false,
        "id": "02F12FDA3ED542B98067B61FC0CB04EE",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Auto-assigning NUTS sampler...\n",
            "Initializing NUTS using jitter+adapt_diag...\n",
            "Multiprocess sampling (4 chains in 4 jobs)\n",
            "NUTS: [scontrol_sigma, Intercept, stress]\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "\n",
              "<style>\n",
              "    /* Turns off some styling */\n",
              "    progress {\n",
              "        /* gets rid of default border in Firefox and Opera. */\n",
              "        border: none;\n",
              "        /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
              "        background-size: auto;\n",
              "    }\n",
              "    progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
              "        background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
              "    }\n",
              "    .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
              "        background: #F44336;\n",
              "    }\n",
              "</style>\n"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Sampling 4 chains for 1_000 tune and 5_000 draw iterations (4_000 + 20_000 draws total) took 7 seconds.\n"
          ]
        }
      ],
      "source": [
        "#===========================\n",
        "#      MCMC采样过程\n",
        "#      注意！！！以下代码可能需要运行几分钟\n",
        "#===========================\n",
        "trace = model.fit(draws=5000,                   # 使用mcmc方法进行采样，draws为采样次数\n",
        "                  tune=1000,                    # tune为调整采样策略的次数，可以决定这些结果是否要被保留\n",
        "                  chains=4,\n",
        "                  random_seed=84735)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "BAF5271F127641EBA905EE210A03C3C8",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "模型诊断部分的分析和之前直接使用 pymc 是一致的。"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 30,
      "metadata": {
        "collapsed": false,
        "id": "506E491F20D243ADAC08DCB91247177A",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "array([[<Axes: title={'center': 'Intercept'}>,\n",
              "        <Axes: title={'center': 'Intercept'}>],\n",
              "       [<Axes: title={'center': 'stress'}>,\n",
              "        <Axes: title={'center': 'stress'}>],\n",
              "       [<Axes: title={'center': 'scontrol_sigma'}>,\n",
              "        <Axes: title={'center': 'scontrol_sigma'}>]], dtype=object)"
            ]
          },
          "execution_count": 30,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "text/html": [
              "<img src=\"https://cdn.kesci.com/upload/rt/506E491F20D243ADAC08DCB91247177A/s3qzbcwvgx.png\">"
            ],
            "text/plain": [
              "<Figure size 1500x1000 with 6 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "az.plot_trace(trace, figsize=(15,10), compact=False)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 31,
      "metadata": {
        "collapsed": false,
        "id": "5347DC431CC24CB18E17E9AC3F2948E9",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "scrolled": false,
        "slideshow": {
          "slide_type": "fragment"
        },
        "tags": [],
        "trusted": true
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>mean</th>\n",
              "      <th>sd</th>\n",
              "      <th>hdi_3%</th>\n",
              "      <th>hdi_97%</th>\n",
              "      <th>mcse_mean</th>\n",
              "      <th>mcse_sd</th>\n",
              "      <th>ess_bulk</th>\n",
              "      <th>ess_tail</th>\n",
              "      <th>r_hat</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>Intercept</th>\n",
              "      <td>56.180</td>\n",
              "      <td>2.540</td>\n",
              "      <td>51.335</td>\n",
              "      <td>60.842</td>\n",
              "      <td>0.015</td>\n",
              "      <td>0.010</td>\n",
              "      <td>29867.0</td>\n",
              "      <td>15095.0</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>stress</th>\n",
              "      <td>-0.411</td>\n",
              "      <td>0.063</td>\n",
              "      <td>-0.527</td>\n",
              "      <td>-0.293</td>\n",
              "      <td>0.000</td>\n",
              "      <td>0.000</td>\n",
              "      <td>30304.0</td>\n",
              "      <td>14619.0</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>scontrol_sigma</th>\n",
              "      <td>5.476</td>\n",
              "      <td>0.293</td>\n",
              "      <td>4.927</td>\n",
              "      <td>6.015</td>\n",
              "      <td>0.002</td>\n",
              "      <td>0.001</td>\n",
              "      <td>30551.0</td>\n",
              "      <td>15758.0</td>\n",
              "      <td>1.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                  mean     sd  hdi_3%  hdi_97%  mcse_mean  mcse_sd  ess_bulk  \\\n",
              "Intercept       56.180  2.540  51.335   60.842      0.015    0.010   29867.0   \n",
              "stress          -0.411  0.063  -0.527   -0.293      0.000    0.000   30304.0   \n",
              "scontrol_sigma   5.476  0.293   4.927    6.015      0.002    0.001   30551.0   \n",
              "\n",
              "                ess_tail  r_hat  \n",
              "Intercept        15095.0    1.0  \n",
              "stress           14619.0    1.0  \n",
              "scontrol_sigma   15758.0    1.0  "
            ]
          },
          "execution_count": 31,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "az.summary(trace)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5058CFED136A4D0286329D42AC6695F5",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 补充材料：为什么使用MCMC是必要的  \n",
        "\n",
        ">我们都知道当后验分布的计算过于复杂时，我们应该选用MCMC来近似后验分布  \n",
        "\n",
        ">但是在这里后验分布究竟有多复杂呢，这里提供了直接的计算(or提供一些复杂的公式让人知难而退)：  \n",
        "\n",
        "1. 该线性模型存在三个参数值$(\\beta_0, \\beta_1, \\sigma)$  \n",
        "\t* 那么先验概率则为三者pdf的乘积：  \n",
        "$$  \n",
        " f(\\beta_0, \\beta_1, \\sigma) = f(\\beta_0) f(\\beta_1) f(\\sigma)  \n",
        "$$  \n",
        "\n",
        "2. 观测到的数据可以用$\\vec{y} = (y_1,y_2,...,y_{n})$来表示  \n",
        "\t* 那么似然函数可以表示为：  \n",
        "$$  \n",
        " L(\\beta_0, \\beta_1, \\sigma | \\vec{y}) = f(\\vec{y}|\\beta_0, \\beta_1, \\sigma) = \\prod_{i=1}^{n}f(y_i|\\beta_0, \\beta_1, \\sigma)  \n",
        " $$  \n",
        "\n",
        "3. 后验分布则可以表示为：  \n",
        "$$  \n",
        "\\begin{split}  \n",
        "f(\\beta_0,\\beta_1,\\sigma \\; | \\; \\vec{y})  \n",
        " & = \\frac{\\text{prior} \\cdot \\text{likelihood}}{ \\int \\text{prior} \\cdot \\text{likelihood}} \\\\  \n",
        " & = \\frac{f(\\beta_0) f(\\beta_1) f(\\sigma) \\cdot \\left[\\prod_{i=1}^{n}f(y_i|\\beta_0, \\beta_1, \\sigma) \\right]}  \n",
        " {\\int\\int\\int f(\\beta_0) f(\\beta_1) f(\\sigma) \\cdot \\left[\\prod_{i=1}^{n}f(y_i|\\beta_0, \\beta_1, \\sigma) \\right] d\\beta_0 d\\beta_1 d\\sigma} \\\\  \n",
        " \\end{split}  \n",
        " $$  \n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6E0C26BE12F342238D40D2E11156CC32",
        "jupyter": {},
        "notebookId": "654a037281633d6c461abb94",
        "runtime": {
          "execution_status": null,
          "is_visible": false,
          "status": "default"
        },
        "scrolled": false,
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "source": [
        "## 总结  \n",
        "\n",
        "* 本节课通过一个简单的例子展示了如何使用 pymc 来建立线性回归模型，并结合之前课程的内容对模型结果进行了分析。  \n",
        "  * 特别是如何进行先验和后验预测的检验。  \n",
        "* 此外，我们介绍了如何使用 bambi 来简化线性模型的定义和拟合。  \n",
        "* 最后，我们强调了 MCMC 方法近似后验分布的重要性。"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.5.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}
